mirror of
https://github.com/itflow-org/itflow
synced 2026-12-02 00:59:03 +00:00
Split the long windows into tabs: New Ticket gets a Planning tab for its due date, starting status, schedule, tags and billing; a product or service has Details, Billing, Ordering and Asset; a service has Service, Recovery and notes, and Depends on; an event has When, and Who and where; an expense has Expense, and Client and 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, and a ticket status Details and What it does; a payment or RMM provider check that finds something wrong opens that field's tab; 26.12.3 changelog entries
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
/*
|
||||
* Admin > Identity Providers - one identity provider's window: Add (?kind=, no id) or Edit (?id=).
|
||||
* Which kind it is is picked from the New menu and stays. How to set it up on the provider's side
|
||||
* is at the top, with the redirect address to register there. The secret is never put back into
|
||||
* is on its first tab, with the redirect address to register there; then Who it signs in, and the
|
||||
* app (or the mail server). The secret is never put back into
|
||||
* the page - left empty, it stays as saved. Saved by save_identity_provider
|
||||
* (admin/post/identity_provider.php).
|
||||
*/
|
||||
@@ -51,174 +52,193 @@ ob_start();
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="alert alert-light border small mb-3" data-identity-provider-setup>
|
||||
<div class="fw-semibold mb-1"><i class="fas fa-fw fa-info-circle me-1"></i>Setting it up</div>
|
||||
<?php if ($kind_key === 'microsoft') { ?>
|
||||
In the Microsoft Entra admin center, under App registrations, make a New registration for accounts in any organizational directory (or only yours), with a Web redirect address of the one below. Copy its Application (client) ID here, then under Certificates & secrets make a client secret and copy its Value. The Microsoft Graph User.Read permission it starts with is all it needs.
|
||||
<?php } elseif ($kind_key === 'google') { ?>
|
||||
In the Google Cloud console, under APIs & Services > Credentials, create an OAuth client ID for a Web application, with an authorized redirect address of the one below, and copy its Client ID and Client secret here. Make its OAuth consent screen Internal to keep it to your own Google Workspace.
|
||||
<?php } elseif ($kind_key === 'nextcloud') { ?>
|
||||
Install the OIDC Identity Provider app (oidc) on your Nextcloud. In its Administration settings, under OpenID Connect, add a client with the redirect address below, of the Confidential type, and copy its client identifier and secret here.
|
||||
<div class="mt-1"><i class="fas fa-fw fa-exclamation-triangle text-warning me-1"></i>ITFlow goes by the email address Nextcloud gives - make sure its users can't change their own, or one of them could sign in here as another.</div>
|
||||
<?php } else { ?>
|
||||
Nothing is set up on the mail server: the password typed on the sign-in page is tried there, in place of the ITFlow password, and the ITFlow two-step code is still asked for. An agent with an administrator role can still use their ITFlow password, for when the mail server is down. Use a server that takes TLS, and list only domains whose mailboxes are on it.
|
||||
<?php } ?>
|
||||
<?php if ($kind['oauth']) { ?>
|
||||
<div class="input-group input-group-sm mt-2">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-link"></i></span>
|
||||
<input type="text" class="form-control font-monospace" id="<?= $form_id ?>Redirect" value="<?= escapeHtml($redirect_uri) ?>" readonly aria-label="Redirect address" data-identity-provider-redirect>
|
||||
<button type="button" class="btn btn-outline-secondary clipboardjs" data-clipboard-target="#<?= $form_id ?>Redirect" title="Copy"><i class="far fa-fw fa-copy"></i></button>
|
||||
<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 ?>SetupTab"><i class="fas fa-fw fa-info-circle me-2 d-none d-lg-inline"></i>Setup</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#<?= $form_id ?>WhoTab"><i class="fas fa-fw fa-users me-2 d-none d-lg-inline"></i>Who it signs in</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#<?= $form_id ?>AppTab"><i class="fas fa-fw <?= $kind['oauth'] ? 'fa-th-large' : 'fa-server' ?> me-2 d-none d-lg-inline"></i><?= $kind['oauth'] ? 'The app' : 'The mail server' ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- How to set it up on the provider's side, whether it is on, and its name -->
|
||||
<div class="tab-pane fade show active" id="<?= $form_id ?>SetupTab">
|
||||
<div class="alert alert-light border small mb-3" data-identity-provider-setup>
|
||||
<?php if ($kind_key === 'microsoft') { ?>
|
||||
In the Microsoft Entra admin center, under App registrations, make a New registration for accounts in any organizational directory (or only yours), with a Web redirect address of the one below. Copy its Application (client) ID here, then under Certificates & secrets make a client secret and copy its Value. The Microsoft Graph User.Read permission it starts with is all it needs.
|
||||
<?php } elseif ($kind_key === 'google') { ?>
|
||||
In the Google Cloud console, under APIs & Services > Credentials, create an OAuth client ID for a Web application, with an authorized redirect address of the one below, and copy its Client ID and Client secret here. Make its OAuth consent screen Internal to keep it to your own Google Workspace.
|
||||
<?php } elseif ($kind_key === 'nextcloud') { ?>
|
||||
Install the OIDC Identity Provider app (oidc) on your Nextcloud. In its Administration settings, under OpenID Connect, add a client with the redirect address below, of the Confidential type, and copy its client identifier and secret here.
|
||||
<div class="mt-1"><i class="fas fa-fw fa-exclamation-triangle text-warning me-1"></i>ITFlow goes by the email address Nextcloud gives - make sure its users can't change their own, or one of them could sign in here as another.</div>
|
||||
<?php } else { ?>
|
||||
Nothing is set up on the mail server: the password typed on the sign-in page is tried there, in place of the ITFlow password, and the ITFlow two-step code is still asked for. An agent with an administrator role can still use their ITFlow password, for when the mail server is down. Use a server that takes TLS, and list only domains whose mailboxes are on it.
|
||||
<?php } ?>
|
||||
<?php if ($kind['oauth']) { ?>
|
||||
<div class="input-group input-group-sm mt-2">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-link"></i></span>
|
||||
<input type="text" class="form-control font-monospace" id="<?= $form_id ?>Redirect" value="<?= escapeHtml($redirect_uri) ?>" readonly aria-label="Redirect address" data-identity-provider-redirect>
|
||||
<button type="button" class="btn btn-outline-secondary clipboardjs" data-clipboard-target="#<?= $form_id ?>Redirect" title="Copy"><i class="far fa-fw fa-copy"></i></button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="enabled" value="1" id="<?= $form_id ?>Enabled" <?= !$row || intval($row['identity_provider_enabled']) ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Enabled">On<?= $kind['oauth'] ? ' - its button is on the sign-in page' : ' - it checks the passwords on its email domains' ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Name">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" id="<?= $form_id ?>Name" maxlength="100" required value="<?= escapeHtml($value('name', $kind['name'])) ?>" placeholder="What you call it">
|
||||
</div>
|
||||
<div class="form-text"><?= $kind['oauth'] ? 'Its button on the sign-in page says "Sign in with" and this name.' : 'What the audit log calls it.' ?></div>
|
||||
</div>
|
||||
|
||||
<div class="itflow-form-section">Who it signs in</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="d-flex flex-wrap gap-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="agents" value="1" id="<?= $form_id ?>Agents" <?= $value('agents', '1') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Agents"><i class="fas fa-fw fa-user-tie text-secondary me-1"></i>Agents</label>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="enabled" value="1" id="<?= $form_id ?>Enabled" <?= !$row || intval($row['identity_provider_enabled']) ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Enabled">On<?= $kind['oauth'] ? ' - its button is on the sign-in page' : ' - it checks the passwords on its email domains' ?></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="contacts" value="1" id="<?= $form_id ?>Contacts" <?= $value('contacts', '0') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Contacts"><i class="fas fa-fw fa-user-friends text-secondary me-1"></i>Client contacts</label>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Name">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" id="<?= $form_id ?>Name" maxlength="100" required value="<?= escapeHtml($value('name', $kind['name'])) ?>" placeholder="What you call it">
|
||||
</div>
|
||||
<div class="form-text"><?= $kind['oauth'] ? 'Its button on the sign-in page says "Sign in with" and this name.' : 'What the audit log calls it.' ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
Only accounts already in ITFlow - an agent, or a contact with portal access - with the same email address. No one new is added.
|
||||
<?php if (!$config_client_portal_enable) { ?>The client portal is off, so it signs in agents only until it is on.<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Domains">Email domains<?= $kind['domains_optional'] ? '' : ' <strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-at"></i></span>
|
||||
<input type="text" class="form-control" name="domains" id="<?= $form_id ?>Domains" maxlength="1000" spellcheck="false" <?= $kind['domains_optional'] ? '' : 'required' ?> value="<?= escapeHtml($value('domains')) ?>" placeholder="example.com, example.org">
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($kind['domains_optional']) { ?>
|
||||
The accounts it signs in are the ones on these domains. Empty, it signs in any <?= escapeHtml($kind['name']) ?> account whose address is in ITFlow - <?= escapeHtml($kind_key === 'microsoft' ? 'Microsoft' : 'Google') ?> vouches for it.
|
||||
<?php } else { ?>
|
||||
The accounts it signs in are the ones on these domains - <?= $kind_key === 'imap' ? 'list only domains whose mailboxes are all on this server.' : 'a Nextcloud\'s users can set their own email address, so list only domains whose people are all on yours.' ?>
|
||||
<!-- Agents and/or contacts, on which email domains, and whether it is the only way in -->
|
||||
<div class="tab-pane fade" id="<?= $form_id ?>WhoTab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex flex-wrap gap-4">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="agents" value="1" id="<?= $form_id ?>Agents" <?= $value('agents', '1') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Agents"><i class="fas fa-fw fa-user-tie text-secondary me-1"></i>Agents</label>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="contacts" value="1" id="<?= $form_id ?>Contacts" <?= $value('contacts', '0') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Contacts"><i class="fas fa-fw fa-user-friends text-secondary me-1"></i>Client contacts</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
Only accounts already in ITFlow - an agent, or a contact with portal access - with the same email address. No one new is added.
|
||||
<?php if (!$config_client_portal_enable) { ?>The client portal is off, so it signs in agents only until it is on.<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Domains">Email domains<?= $kind['domains_optional'] ? '' : ' <strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-at"></i></span>
|
||||
<input type="text" class="form-control" name="domains" id="<?= $form_id ?>Domains" maxlength="1000" spellcheck="false" <?= $kind['domains_optional'] ? '' : 'required' ?> value="<?= escapeHtml($value('domains')) ?>" placeholder="example.com, example.org">
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($kind['domains_optional']) { ?>
|
||||
The accounts it signs in are the ones on these domains. Empty, it signs in any <?= escapeHtml($kind['name']) ?> account whose address is in ITFlow - <?= escapeHtml($kind_key === 'microsoft' ? 'Microsoft' : 'Google') ?> vouches for it.
|
||||
<?php } else { ?>
|
||||
The accounts it signs in are the ones on these domains - <?= $kind_key === 'imap' ? 'list only domains whose mailboxes are all on this server.' : 'a Nextcloud\'s users can set their own email address, so list only domains whose people are all on yours.' ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($kind['oauth']) { ?>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="required" value="1" id="<?= $form_id ?>Required" <?= $value('required', '0') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Required">Required - the accounts on its email domains can't sign in with a password</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Passkeys still work, and an agent with an administrator role keeps their password, to get back in when it is down. Needs email domains.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<!-- The app registered at the provider, or the mail server it asks -->
|
||||
<div class="tab-pane fade" id="<?= $form_id ?>AppTab">
|
||||
<?php if ($kind_key === 'nextcloud') { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Url">Address <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-globe"></i></span>
|
||||
<input type="url" class="form-control" name="url" id="<?= $form_id ?>Url" maxlength="500" spellcheck="false" required value="<?= escapeHtml($value('url')) ?>" placeholder="https://cloud.example.com">
|
||||
</div>
|
||||
<div class="form-text">Where your Nextcloud is. ITFlow asks it for its OpenID Connect settings when you save.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array('client_id', $fields, true)) { ?>
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>ClientId"><?= $kind_key === 'microsoft' ? 'Application (client) ID' : 'Client ID' ?> <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-fingerprint"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="client_id" id="<?= $form_id ?>ClientId" maxlength="255" spellcheck="false" required value="<?= escapeHtml($value('client_id')) ?>"
|
||||
placeholder="<?= $kind_key === 'microsoft' ? 'e721e3b6-01d6-50e8-7f22-c84d951a52e7' : ($kind_key === 'google' ? '…apps.googleusercontent.com' : 'From its client') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Secret">Client secret <?= $secret_saved ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-key"></i></span>
|
||||
<input type="password" class="form-control" name="client_secret" id="<?= $form_id ?>Secret" maxlength="1000" autocomplete="new-password" <?= $secret_saved ? '' : 'required' ?>
|
||||
placeholder="<?= $secret_saved ? 'Saved - type a new one to replace it' : ($kind_key === 'microsoft' ? 'Its Value, not its ID' : 'From its client') ?>">
|
||||
</div>
|
||||
<?php if ($kind_key === 'microsoft') { ?><div class="form-text">A secret runs out - put the new one here before it does.</div><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array('tenant', $fields, true)) { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Tenant">Directory (tenant) ID</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="tenant" id="<?= $form_id ?>Tenant" maxlength="100" spellcheck="false" value="<?= escapeHtml($value('tenant')) ?>" placeholder="Any organization">
|
||||
</div>
|
||||
<div class="form-text">Only for an app registered for your directory alone - its ID, from the app's Overview. Empty takes work accounts from any organization; personal Microsoft accounts never sign in.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($kind_key === 'imap') { ?>
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label" for="<?= $form_id ?>Host">Server <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-server"></i></span>
|
||||
<input type="text" class="form-control" name="url" id="<?= $form_id ?>Host" maxlength="255" spellcheck="false" required value="<?= escapeHtml($value('url')) ?>" placeholder="mail.example.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label" for="<?= $form_id ?>Port">Port</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-plug"></i></span>
|
||||
<input type="number" class="form-control" name="port" id="<?= $form_id ?>Port" min="1" max="65535" value="<?= $row ? intval($row['identity_provider_port']) : '' ?>" placeholder="993">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Security">Security</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
|
||||
<select class="form-select select2" name="security" id="<?= $form_id ?>Security">
|
||||
<?php foreach (['ssl' => 'SSL/TLS', 'starttls' => 'STARTTLS', 'none' => 'None - the password goes unencrypted'] as $option => $label) { ?>
|
||||
<option value="<?= $option ?>" <?= $security === $option ? 'selected' : '' ?><?= selectOptionData(['icon' => $option === 'none' ? 'fas fa-lock-open' : 'fas fa-lock']) ?>><?= escapeHtml($label) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">Empty port is 993 for SSL/TLS, 143 otherwise. Its certificate has to be a valid one.</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Username">It is signed in to with</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="username" id="<?= $form_id ?>Username">
|
||||
<option value="email" <?= $value('username', 'email') !== 'local' ? 'selected' : '' ?><?= selectOptionData(['icon' => 'fas fa-at', 'description' => 'name@example.com']) ?>>The whole email address</option>
|
||||
<option value="local" <?= $value('username') === 'local' ? 'selected' : '' ?><?= selectOptionData(['icon' => 'fas fa-user', 'description' => 'name']) ?>>The part before the @</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($kind['oauth']) { ?>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="required" value="1" id="<?= $form_id ?>Required" <?= $value('required', '0') === '1' ? 'checked' : '' ?>>
|
||||
<label class="form-check-label" for="<?= $form_id ?>Required">Required - the accounts on its email domains can't sign in with a password</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Passkeys still work, and an agent with an administrator role keeps their password, to get back in when it is down. Needs email domains.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="itflow-form-section"><?= $kind['oauth'] ? 'The app' : 'The mail server' ?></div>
|
||||
|
||||
<?php if ($kind_key === 'nextcloud') { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Url">Address <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-globe"></i></span>
|
||||
<input type="url" class="form-control" name="url" id="<?= $form_id ?>Url" maxlength="500" spellcheck="false" required value="<?= escapeHtml($value('url')) ?>" placeholder="https://cloud.example.com">
|
||||
</div>
|
||||
<div class="form-text">Where your Nextcloud is. ITFlow asks it for its OpenID Connect settings when you save.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array('client_id', $fields, true)) { ?>
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>ClientId"><?= $kind_key === 'microsoft' ? 'Application (client) ID' : 'Client ID' ?> <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-fingerprint"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="client_id" id="<?= $form_id ?>ClientId" maxlength="255" spellcheck="false" required value="<?= escapeHtml($value('client_id')) ?>"
|
||||
placeholder="<?= $kind_key === 'microsoft' ? 'e721e3b6-01d6-50e8-7f22-c84d951a52e7' : ($kind_key === 'google' ? '…apps.googleusercontent.com' : 'From its client') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Secret">Client secret <?= $secret_saved ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-key"></i></span>
|
||||
<input type="password" class="form-control" name="client_secret" id="<?= $form_id ?>Secret" maxlength="1000" autocomplete="new-password" <?= $secret_saved ? '' : 'required' ?>
|
||||
placeholder="<?= $secret_saved ? 'Saved - type a new one to replace it' : ($kind_key === 'microsoft' ? 'Its Value, not its ID' : 'From its client') ?>">
|
||||
</div>
|
||||
<?php if ($kind_key === 'microsoft') { ?><div class="form-text">A secret runs out - put the new one here before it does.</div><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array('tenant', $fields, true)) { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $form_id ?>Tenant">Directory (tenant) ID</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="tenant" id="<?= $form_id ?>Tenant" maxlength="100" spellcheck="false" value="<?= escapeHtml($value('tenant')) ?>" placeholder="Any organization">
|
||||
</div>
|
||||
<div class="form-text">Only for an app registered for your directory alone - its ID, from the app's Overview. Empty takes work accounts from any organization; personal Microsoft accounts never sign in.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($kind_key === 'imap') { ?>
|
||||
<div class="row g-3 mb-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label" for="<?= $form_id ?>Host">Server <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-server"></i></span>
|
||||
<input type="text" class="form-control" name="url" id="<?= $form_id ?>Host" maxlength="255" spellcheck="false" required value="<?= escapeHtml($value('url')) ?>" placeholder="mail.example.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label" for="<?= $form_id ?>Port">Port</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-plug"></i></span>
|
||||
<input type="number" class="form-control" name="port" id="<?= $form_id ?>Port" min="1" max="65535" value="<?= $row ? intval($row['identity_provider_port']) : '' ?>" placeholder="993">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Security">Security</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-lock"></i></span>
|
||||
<select class="form-select select2" name="security" id="<?= $form_id ?>Security">
|
||||
<?php foreach (['ssl' => 'SSL/TLS', 'starttls' => 'STARTTLS', 'none' => 'None - the password goes unencrypted'] as $option => $label) { ?>
|
||||
<option value="<?= $option ?>" <?= $security === $option ? 'selected' : '' ?><?= selectOptionData(['icon' => $option === 'none' ? 'fas fa-lock-open' : 'fas fa-lock']) ?>><?= escapeHtml($label) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">Empty port is 993 for SSL/TLS, 143 otherwise. Its certificate has to be a valid one.</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="<?= $form_id ?>Username">It is signed in to with</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="username" id="<?= $form_id ?>Username">
|
||||
<option value="email" <?= $value('username', 'email') !== 'local' ? 'selected' : '' ?><?= selectOptionData(['icon' => 'fas fa-at', 'description' => 'name@example.com']) ?>>The whole email address</option>
|
||||
<option value="local" <?= $value('username') === 'local' ? 'selected' : '' ?><?= selectOptionData(['icon' => 'fas fa-user', 'description' => 'name']) ?>>The part before the @</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="save_identity_provider" class="btn btn-primary fw-bold"><i class="fas fa-check me-2"></i><?= $row ? 'Save' : 'Create' ?></button>
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
* payment_provider_add.php) or Edit. Its keys - the secret one never put back
|
||||
* into the page, so left empty it stays - whether it is on, the account its
|
||||
* payments go into, the card limit, whether its fees are recorded as
|
||||
* expenses, and whether clients pay a card fee to cover them. Save asks first (check_payment_provider,
|
||||
* admin/post/payment_provider.php): what is wrong shows beside each field and
|
||||
* the window stays open; once all is right, it saves.
|
||||
* expenses, and whether clients pay a card fee to cover them - on its Keys,
|
||||
* Payments and Card fee tabs. Save asks first (check_payment_provider,
|
||||
* admin/post/payment_provider.php): what is wrong shows beside each field,
|
||||
* its tab opened, and the window stays open; once all is right, it saves.
|
||||
*/
|
||||
|
||||
require_once '../../includes/modal_header.php';
|
||||
@@ -104,145 +105,166 @@ ob_start();
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderDescription">Description</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<input type="text" class="form-control" name="description" id="paymentProviderDescription" maxlength="250" placeholder="What it is for, if you like" value="<?= escapeHtml($row['payment_provider_description'] ?? '') ?>">
|
||||
</div>
|
||||
<?= $error_for('description') ?>
|
||||
</div>
|
||||
|
||||
<h6 class="fw-semibold mt-4 mb-1">Keys</h6>
|
||||
<p class="small text-body-secondary mb-2">From <a href="<?= escapeHtml($kind['keys_url']) ?>" target="_blank" rel="noopener noreferrer"><?= escapeHtml($name) ?>'s Developers > API keys <i class="fas fa-external-link-alt fa-xs"></i></a> - both live, or both test while you try it out.</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderPublicKey">Publishable key <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-eye"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="public_key" id="paymentProviderPublicKey" maxlength="250" spellcheck="false" placeholder="<?= escapeHtml($kind['public_example']) ?>" value="<?= escapeHtml($row['payment_provider_public_key'] ?? '') ?>">
|
||||
</div>
|
||||
<?= $error_for('public_key') ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderSecretKey">Secret key <?= $row ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-key"></i></span>
|
||||
<input type="password" class="form-control font-monospace" name="private_key" id="paymentProviderSecretKey" maxlength="250" spellcheck="false" autocomplete="new-password"
|
||||
placeholder="<?= $row && trim((string) $row['payment_provider_private_key']) !== '' ? 'Saved - type a new one to replace it' : escapeHtml($kind['secret_example']) ?>">
|
||||
</div>
|
||||
<?= $error_for('private_key') ?>
|
||||
<div class="form-text">A restricted key (rk_...) does too, with write access to payment intents, customers, setup intents and payment methods, and read on the account.</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-success py-2 small d-none" data-provider-account></div>
|
||||
|
||||
<h6 class="fw-semibold mt-4 mb-2">Payments</h6>
|
||||
<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="#paymentProviderKeys"><i class="fas fa-fw fa-key me-2 d-none d-lg-inline"></i>Keys</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#paymentProviderPayments"><i class="fas fa-fw fa-piggy-bank me-2 d-none d-lg-inline"></i>Payments</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#paymentProviderCardFeeTab"><i class="fas fa-fw fa-percent me-2 d-none d-lg-inline"></i>Card fee</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<?php if (!moduleOn('bookkeeping')) { // Bookkeeping off - into the account it's set to, or the default ?>
|
||||
<input type="hidden" name="account" value="<?= $account_id ?: bookkeepingAccount('payment') ?>">
|
||||
<?php } else { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderAccount">Payments go into <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-piggy-bank"></i></span>
|
||||
<select class="form-select select2" name="account" id="paymentProviderAccount">
|
||||
<option value="">- Select an account -</option>
|
||||
<?php while ($account = mysqli_fetch_assoc($accounts)) { ?>
|
||||
<option value="<?= intval($account['account_id']) ?>" <?= intval($account['account_id']) === $account_id ? 'selected' : '' ?>><?= escapeHtml($account['account_name']) ?><?= $account['account_archived_at'] ? ' (archived)' : '' ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('account') ?>
|
||||
<div class="form-text">An account of its own, named for it, makes its payouts easy to match.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderThreshold">Card limit</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-shopping-cart"></i></span>
|
||||
<input type="text" class="form-control" name="threshold" id="paymentProviderThreshold" inputmode="decimal" maxlength="16" placeholder="No limit" value="<?= $threshold > 0 ? escapeHtml(number_format($threshold, 2, '.', '')) : '' ?>">
|
||||
<?php if ($currency !== '') { ?><span class="input-group-text"><?= escapeHtml($currency) ?></span><?php } ?>
|
||||
</div>
|
||||
<?= $error_for('threshold') ?>
|
||||
<div class="form-text">An invoice of this much or more can't be paid by card. Empty for no limit.</div>
|
||||
</div>
|
||||
|
||||
<h6 class="fw-semibold mt-4 mb-2">Fees</h6>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="record_fees" value="1" id="paymentProviderRecordFees" <?= $records_fees ? 'checked' : '' ?> data-provider-fees-switch>
|
||||
<label class="form-check-label" for="paymentProviderRecordFees">Record its fees as expenses</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Its fee on each card payment is recorded as an expense from the account above, a few minutes after Stripe settles the payment.</div>
|
||||
</div>
|
||||
|
||||
<div data-provider-fees>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderVendor">Paid to <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<select class="form-select select2" name="expense_vendor" id="paymentProviderVendor">
|
||||
<option value="">- Select a vendor -</option>
|
||||
<?php while ($vendor = mysqli_fetch_assoc($vendors)) { ?>
|
||||
<option value="<?= intval($vendor['vendor_id']) ?>" <?= intval($vendor['vendor_id']) === $vendor_id ? 'selected' : '' ?>><?= escapeHtml($vendor['vendor_name']) ?><?= $vendor['vendor_archived_at'] ? ' (archived)' : '' ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('expense_vendor') ?>
|
||||
<div class="form-text">One of your own vendors - <?= escapeHtml($name) ?> itself.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderCategory">Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-list"></i></span>
|
||||
<select class="form-select select2" name="expense_category" id="paymentProviderCategory">
|
||||
<option value="">- Select a category -</option>
|
||||
<?= categoryOptionsHtml('Expense', $category_id ?: null) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Expense') ?>
|
||||
</div>
|
||||
<?= $error_for('expense_category') ?>
|
||||
<div class="form-text">Processing Fee, or the like.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="card_fee" value="1" id="paymentProviderCardFee" <?= $card_fee ? 'checked' : '' ?> data-provider-card-fee-switch>
|
||||
<label class="form-check-label" for="paymentProviderCardFee">Clients pay the card fee</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Each card payment is made bigger by what <?= escapeHtml($name) ?> takes of it, so you get what the invoice is for. The fee goes on the invoice as a Card Fee line, and clients see it before they pay - in the client portal, through an invoice's link, by autopay, or when you charge a saved card. A client can be let off it on their Billing tab.</div>
|
||||
</div>
|
||||
|
||||
<div data-provider-card-fee>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-3">
|
||||
<label class="form-label" for="paymentProviderCardFeePercent">Percent</label>
|
||||
<!-- What it is for, and its keys -->
|
||||
<div class="tab-pane fade show active" id="paymentProviderKeys">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderDescription">Description</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-percent"></i></span>
|
||||
<input type="text" class="form-control" name="card_fee_percent" id="paymentProviderCardFeePercent" inputmode="decimal" maxlength="5" placeholder="2.9" value="<?= $card_fee_percent > 0 ? escapeHtml(rtrim(rtrim(number_format($card_fee_percent, 2, '.', ''), '0'), '.')) : '' ?>">
|
||||
<span class="input-group-text">%</span>
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-align-left"></i></span>
|
||||
<input type="text" class="form-control" name="description" id="paymentProviderDescription" maxlength="250" placeholder="What it is for, if you like" value="<?= escapeHtml($row['payment_provider_description'] ?? '') ?>">
|
||||
</div>
|
||||
<?= $error_for('card_fee_percent') ?>
|
||||
<?= $error_for('description') ?>
|
||||
</div>
|
||||
<div class="col-sm-6 mb-3">
|
||||
<label class="form-label" for="paymentProviderCardFeeFixed">Plus</label>
|
||||
|
||||
<p class="small text-body-secondary mb-3">From <a href="<?= escapeHtml($kind['keys_url']) ?>" target="_blank" rel="noopener noreferrer"><?= escapeHtml($name) ?>'s Developers > API keys <i class="fas fa-external-link-alt fa-xs"></i></a> - both live, or both test while you try it out.</p>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderPublicKey">Publishable key <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-coins"></i></span>
|
||||
<input type="text" class="form-control" name="card_fee_fixed" id="paymentProviderCardFeeFixed" inputmode="decimal" maxlength="6" placeholder="0.30" value="<?= $card_fee_fixed > 0 ? escapeHtml(number_format($card_fee_fixed, 2, '.', '')) : '' ?>">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-eye"></i></span>
|
||||
<input type="text" class="form-control font-monospace" name="public_key" id="paymentProviderPublicKey" maxlength="250" spellcheck="false" placeholder="<?= escapeHtml($kind['public_example']) ?>" value="<?= escapeHtml($row['payment_provider_public_key'] ?? '') ?>">
|
||||
</div>
|
||||
<?= $error_for('public_key') ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderSecretKey">Secret key <?= $row ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-key"></i></span>
|
||||
<input type="password" class="form-control font-monospace" name="private_key" id="paymentProviderSecretKey" maxlength="250" spellcheck="false" autocomplete="new-password"
|
||||
placeholder="<?= $row && trim((string) $row['payment_provider_private_key']) !== '' ? 'Saved - type a new one to replace it' : escapeHtml($kind['secret_example']) ?>">
|
||||
</div>
|
||||
<?= $error_for('private_key') ?>
|
||||
<div class="form-text">A restricted key (rk_...) does too, with write access to payment intents, customers, setup intents and payment methods, and read on the account.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Where its payments go, the most a card can pay, and its fees as expenses -->
|
||||
<div class="tab-pane fade" id="paymentProviderPayments">
|
||||
<?php if (!moduleOn('bookkeeping')) { // Bookkeeping off - into the account it's set to, or the default ?>
|
||||
<input type="hidden" name="account" value="<?= $account_id ?: bookkeepingAccount('payment') ?>">
|
||||
<?php } else { ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderAccount">Payments go into <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-piggy-bank"></i></span>
|
||||
<select class="form-select select2" name="account" id="paymentProviderAccount">
|
||||
<option value="">- Select an account -</option>
|
||||
<?php while ($account = mysqli_fetch_assoc($accounts)) { ?>
|
||||
<option value="<?= intval($account['account_id']) ?>" <?= intval($account['account_id']) === $account_id ? 'selected' : '' ?>><?= escapeHtml($account['account_name']) ?><?= $account['account_archived_at'] ? ' (archived)' : '' ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('account') ?>
|
||||
<div class="form-text">An account of its own, named for it, makes its payouts easy to match.</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderThreshold">Card limit</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-shopping-cart"></i></span>
|
||||
<input type="text" class="form-control" name="threshold" id="paymentProviderThreshold" inputmode="decimal" maxlength="16" placeholder="No limit" value="<?= $threshold > 0 ? escapeHtml(number_format($threshold, 2, '.', '')) : '' ?>">
|
||||
<?php if ($currency !== '') { ?><span class="input-group-text"><?= escapeHtml($currency) ?></span><?php } ?>
|
||||
</div>
|
||||
<?= $error_for('card_fee_fixed') ?>
|
||||
<?= $error_for('threshold') ?>
|
||||
<div class="form-text">An invoice of this much or more can't be paid by card. Empty for no limit.</div>
|
||||
</div>
|
||||
|
||||
<div class="itflow-form-section">Fees</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="record_fees" value="1" id="paymentProviderRecordFees" <?= $records_fees ? 'checked' : '' ?> data-provider-fees-switch>
|
||||
<label class="form-check-label" for="paymentProviderRecordFees">Record its fees as expenses</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Its fee on each card payment is recorded as an expense from the account above, a few minutes after Stripe settles the payment.</div>
|
||||
</div>
|
||||
|
||||
<div data-provider-fees>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderVendor">Paid to <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-building"></i></span>
|
||||
<select class="form-select select2" name="expense_vendor" id="paymentProviderVendor">
|
||||
<option value="">- Select a vendor -</option>
|
||||
<?php while ($vendor = mysqli_fetch_assoc($vendors)) { ?>
|
||||
<option value="<?= intval($vendor['vendor_id']) ?>" <?= intval($vendor['vendor_id']) === $vendor_id ? 'selected' : '' ?>><?= escapeHtml($vendor['vendor_name']) ?><?= $vendor['vendor_archived_at'] ? ' (archived)' : '' ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('expense_vendor') ?>
|
||||
<div class="form-text">One of your own vendors - <?= escapeHtml($name) ?> itself.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="paymentProviderCategory">Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-list"></i></span>
|
||||
<select class="form-select select2" name="expense_category" id="paymentProviderCategory">
|
||||
<option value="">- Select a category -</option>
|
||||
<?= categoryOptionsHtml('Expense', $category_id ?: null) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Expense') ?>
|
||||
</div>
|
||||
<?= $error_for('expense_category') ?>
|
||||
<div class="form-text">Processing Fee, or the like.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text mt-n2 mb-3">What <?= escapeHtml($name) ?> charges you on a card payment - your account's rate, as 2.9% plus 0.30. Card surcharges have rules where you and your clients are: in the US, for one, the card networks cap them and don't allow them on debit cards, and some states limit them further.</div>
|
||||
</div>
|
||||
|
||||
<!-- Clients paying the card fee -->
|
||||
<div class="tab-pane fade" id="paymentProviderCardFeeTab">
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="card_fee" value="1" id="paymentProviderCardFee" <?= $card_fee ? 'checked' : '' ?> data-provider-card-fee-switch>
|
||||
<label class="form-check-label" for="paymentProviderCardFee">Clients pay the card fee</label>
|
||||
</div>
|
||||
<div class="form-text ps-5">Each card payment is made bigger by what <?= escapeHtml($name) ?> takes of it, so you get what the invoice is for. The fee goes on the invoice as a Card Fee line, and clients see it before they pay - in the client portal, through an invoice's link, by autopay, or when you charge a saved card. A client can be let off it on their Billing tab.</div>
|
||||
</div>
|
||||
|
||||
<div data-provider-card-fee>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 mb-3">
|
||||
<label class="form-label" for="paymentProviderCardFeePercent">Percent</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-percent"></i></span>
|
||||
<input type="text" class="form-control" name="card_fee_percent" id="paymentProviderCardFeePercent" inputmode="decimal" maxlength="5" placeholder="2.9" value="<?= $card_fee_percent > 0 ? escapeHtml(rtrim(rtrim(number_format($card_fee_percent, 2, '.', ''), '0'), '.')) : '' ?>">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<?= $error_for('card_fee_percent') ?>
|
||||
</div>
|
||||
<div class="col-sm-6 mb-3">
|
||||
<label class="form-label" for="paymentProviderCardFeeFixed">Plus</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-coins"></i></span>
|
||||
<input type="text" class="form-control" name="card_fee_fixed" id="paymentProviderCardFeeFixed" inputmode="decimal" maxlength="6" placeholder="0.30" value="<?= $card_fee_fixed > 0 ? escapeHtml(number_format($card_fee_fixed, 2, '.', '')) : '' ?>">
|
||||
<?php if ($currency !== '') { ?><span class="input-group-text"><?= escapeHtml($currency) ?></span><?php } ?>
|
||||
</div>
|
||||
<?= $error_for('card_fee_fixed') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text mt-n2 mb-3">What <?= escapeHtml($name) ?> charges you on a card payment - your account's rate, as 2.9% plus 0.30. Card surcharges have rules where you and your clients are: in the US, for one, the card networks cap them and don't allow them on debit cards, and some states limit them further.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="<?= $row ? 'edit_payment_provider' : 'add_payment_provider' ?>" class="btn btn-primary fw-bold" data-provider-save <?= !$row && !$free_kinds ? 'disabled' : '' ?>>
|
||||
@@ -312,6 +334,9 @@ ob_start();
|
||||
box.classList.add('d-block');
|
||||
}
|
||||
});
|
||||
if (first && window.itflowRevealTab) {
|
||||
window.itflowRevealTab(first);
|
||||
}
|
||||
if (first && first.offsetParent !== null) {
|
||||
first.focus();
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/*
|
||||
* Admin > RMM Providers - one provider's window: Add (no id) or Edit. Which RMM it is is
|
||||
* picked when it is added and stays; each kind brings its own fields (rmmProviderKinds() in
|
||||
* functions/rmm.php) - addresses, a key, a secret. A key or secret is never put back into the
|
||||
* functions/rmm.php) - addresses, a key, a secret - on the Connection tab. A key or secret is never put back into the
|
||||
* page, so left empty it stays. A kind that has alerts can have them open tickets, from the
|
||||
* level picked, in a category. Desktops, laptops, servers and virtual machines each come in as
|
||||
* the asset type picked for them (rmmProviderAssetTypes()). Save asks first (check_rmm_provider, admin/post/rmm.php): what
|
||||
* level picked, in a category, on its Alerts tab. Desktops, laptops, servers and virtual machines
|
||||
* each come in as the asset type picked for them (rmmProviderAssetTypes()), on Asset types. Save asks first (check_rmm_provider, admin/post/rmm.php): what
|
||||
* is wrong shows beside each field and the window stays open; once all is right it saves, and
|
||||
* tries the connection. A network platform's window (family=network, or one being edited)
|
||||
* offers the network kinds - UniFi - in its words.
|
||||
@@ -70,129 +70,154 @@ ob_start();
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderKind"><?= $words['kind'] ?> <?= $row ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-shapes"></i></span>
|
||||
<select class="form-select select2" name="kind" id="rmmProviderKind" data-rmm-kind <?= $row ? 'disabled' : '' ?>>
|
||||
<?php foreach ($kinds as $key => $info) { ?>
|
||||
<option value="<?= escapeHtml($key) ?>" <?= $key === $kind_key ? 'selected' : '' ?><?= selectOptionData(['icon' => $info['icon'], 'description' => $info['about']]) ?>><?= escapeHtml($info['name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('kind') ?>
|
||||
<?php if ($row) { ?><div class="form-text"><?= $family === 'network' ? 'Which kind it is stays - add another platform for another one.' : 'Which RMM it is stays - add another provider for another one.' ?></div><?php } ?>
|
||||
</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="#rmmProviderConnection"><i class="fas fa-fw fa-plug me-2 d-none d-lg-inline"></i>Connection</a>
|
||||
</li>
|
||||
<?php if ($alerts_offered) { ?>
|
||||
<li class="nav-item <?= isset($kind['alerts'], $kind['alert']) ? '' : 'd-none' ?>" data-rmm-alerts>
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#rmmProviderAlerts"><i class="fas fa-fw fa-bell me-2 d-none d-lg-inline"></i>Alerts</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if (rmmAssetTypesReady()) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-bs-toggle="pill" href="#rmmProviderAssetTypes"><i class="fas fa-fw fa-laptop me-2 d-none d-lg-inline"></i>Asset types</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderName">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" id="rmmProviderName" maxlength="100" value="<?= escapeHtml($row ? $row['rmm_provider_name'] : ($kind['default_name'] ?? $kind['name'])) ?>" placeholder="What you call it">
|
||||
</div>
|
||||
<?= $error_for('name') ?>
|
||||
<div class="form-text">What assets and the audit log call it. Two of the same kind need names of their own.</div>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
||||
<?php foreach ($kinds as $key => $info) {
|
||||
$shown = $key === $kind_key; ?>
|
||||
<div data-rmm-kind-fields="<?= escapeHtml($key) ?>" class="<?= $shown ? '' : 'd-none' ?>">
|
||||
<?php foreach ($info['fields'] as $field => $about) {
|
||||
$id = 'rmmProvider' . ucfirst($key) . str_replace('_', '', ucwords($field, '_'));
|
||||
$saved = $row && $shown ? (string) ($row["rmm_provider_$field"] ?? '') : '';
|
||||
$secret = $about['type'] === 'secret';
|
||||
if ($about['type'] === 'switch') { ?>
|
||||
<!-- Which kind, its name, and how ITFlow reaches it -->
|
||||
<div class="tab-pane fade show active" id="rmmProviderConnection">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderKind"><?= $words['kind'] ?> <?= $row ? '' : '<strong class="text-danger">*</strong>' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-shapes"></i></span>
|
||||
<select class="form-select select2" name="kind" id="rmmProviderKind" data-rmm-kind <?= $row ? 'disabled' : '' ?>>
|
||||
<?php foreach ($kinds as $key => $info) { ?>
|
||||
<option value="<?= escapeHtml($key) ?>" <?= $key === $kind_key ? 'selected' : '' ?><?= selectOptionData(['icon' => $info['icon'], 'description' => $info['about']]) ?>><?= escapeHtml($info['name']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('kind') ?>
|
||||
<?php if ($row) { ?><div class="form-text"><?= $family === 'network' ? 'Which kind it is stays - add another platform for another one.' : 'Which RMM it is stays - add another provider for another one.' ?></div><?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderName">Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" id="rmmProviderName" maxlength="100" value="<?= escapeHtml($row ? $row['rmm_provider_name'] : ($kind['default_name'] ?? $kind['name'])) ?>" placeholder="What you call it">
|
||||
</div>
|
||||
<?= $error_for('name') ?>
|
||||
<div class="form-text">What assets and the audit log call it. Two of the same kind need names of their own.</div>
|
||||
</div>
|
||||
|
||||
<?php foreach ($kinds as $key => $info) {
|
||||
$shown = $key === $kind_key; ?>
|
||||
<div data-rmm-kind-fields="<?= escapeHtml($key) ?>" class="<?= $shown ? '' : 'd-none' ?>">
|
||||
<?php foreach ($info['fields'] as $field => $about) {
|
||||
$id = 'rmmProvider' . ucfirst($key) . str_replace('_', '', ucwords($field, '_'));
|
||||
$saved = $row && $shown ? (string) ($row["rmm_provider_$field"] ?? '') : '';
|
||||
$secret = $about['type'] === 'secret';
|
||||
if ($about['type'] === 'switch') { ?>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="<?= $field ?>" value="1" id="<?= $id ?>" <?= intval($saved) ? 'checked' : '' ?> <?= $shown ? '' : 'disabled' ?>>
|
||||
<label class="form-check-label" for="<?= $id ?>"><?= escapeHtml($about['label']) ?></label>
|
||||
</div>
|
||||
<?= $error_for($field) ?>
|
||||
<div class="form-text ps-5"><?= escapeHtml($about['help']) ?></div>
|
||||
</div>
|
||||
<?php continue;
|
||||
}
|
||||
$placeholder = $secret ? ($saved !== '' ? 'Saved - type a new one to replace it' : '') : $about['placeholder'];
|
||||
if ($field === 'web_url' && $row && $shown && isset($info['dashboard'])) {
|
||||
// The address it works out when this is left empty
|
||||
$placeholder = (string) call_user_func($info['dashboard'], array_merge($row, ['rmm_provider_web_url' => ''])) ?: $placeholder;
|
||||
} ?>
|
||||
<div class="mb-3">
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="<?= $field ?>" value="1" id="<?= $id ?>" <?= intval($saved) ? 'checked' : '' ?> <?= $shown ? '' : 'disabled' ?>>
|
||||
<label class="form-check-label" for="<?= $id ?>"><?= escapeHtml($about['label']) ?></label>
|
||||
<label class="form-label" for="<?= $id ?>"><?= escapeHtml($about['label']) ?> <?= !empty($about['required']) && !($secret && $saved !== '') ? '<strong class="text-danger">*</strong>' : '' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw <?= escapeHtml($about['icon']) ?>"></i></span>
|
||||
<?php if ($secret) { ?>
|
||||
<input type="password" class="form-control font-monospace" name="<?= $field ?>" id="<?= $id ?>" maxlength="500" spellcheck="false" autocomplete="new-password" placeholder="<?= escapeHtml($placeholder) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } elseif ($about['type'] === 'text') { ?>
|
||||
<input type="text" class="form-control" name="<?= $field ?>" id="<?= $id ?>" maxlength="255" spellcheck="false" autocomplete="off" placeholder="<?= escapeHtml($placeholder) ?>" value="<?= escapeHtml($saved) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } else { ?>
|
||||
<input type="url" class="form-control" name="<?= $field ?>" id="<?= $id ?>" maxlength="500" spellcheck="false" placeholder="<?= escapeHtml($placeholder) ?>" value="<?= escapeHtml($saved) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?= $error_for($field) ?>
|
||||
<div class="form-text ps-5"><?= escapeHtml($about['help']) ?></div>
|
||||
</div>
|
||||
<?php continue;
|
||||
}
|
||||
$placeholder = $secret ? ($saved !== '' ? 'Saved - type a new one to replace it' : '') : $about['placeholder'];
|
||||
if ($field === 'web_url' && $row && $shown && isset($info['dashboard'])) {
|
||||
// The address it works out when this is left empty
|
||||
$placeholder = (string) call_user_func($info['dashboard'], array_merge($row, ['rmm_provider_web_url' => ''])) ?: $placeholder;
|
||||
} ?>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="<?= $id ?>"><?= escapeHtml($about['label']) ?> <?= !empty($about['required']) && !($secret && $saved !== '') ? '<strong class="text-danger">*</strong>' : '' ?></label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw <?= escapeHtml($about['icon']) ?>"></i></span>
|
||||
<?php if ($secret) { ?>
|
||||
<input type="password" class="form-control font-monospace" name="<?= $field ?>" id="<?= $id ?>" maxlength="500" spellcheck="false" autocomplete="new-password" placeholder="<?= escapeHtml($placeholder) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } elseif ($about['type'] === 'text') { ?>
|
||||
<input type="text" class="form-control" name="<?= $field ?>" id="<?= $id ?>" maxlength="255" spellcheck="false" autocomplete="off" placeholder="<?= escapeHtml($placeholder) ?>" value="<?= escapeHtml($saved) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } else { ?>
|
||||
<input type="url" class="form-control" name="<?= $field ?>" id="<?= $id ?>" maxlength="500" spellcheck="false" placeholder="<?= escapeHtml($placeholder) ?>" value="<?= escapeHtml($saved) ?>" <?= $shown ? '' : 'disabled' ?>>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?= $error_for($field) ?>
|
||||
<div class="form-text"><?= escapeHtml($about['help']) ?>
|
||||
<?php if ($secret && $info['docs_url'] !== '') { ?><a href="<?= escapeHtml($info['docs_url']) ?>" target="_blank" rel="noopener noreferrer"><?= escapeHtml($info['short']) ?>'s API keys <i class="fas fa-external-link-alt fa-xs"></i></a><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($alerts_offered) { ?>
|
||||
<div data-rmm-alerts class="<?= isset($kind['alerts'], $kind['alert']) ? '' : 'd-none' ?>">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderAlertLevel">Alerts open tickets</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-bell"></i></span>
|
||||
<select class="form-select select2" name="alert_level" id="rmmProviderAlertLevel" data-rmm-alert-level>
|
||||
<?php foreach (rmmAlertLevels() as $level_key => $level_label) { ?>
|
||||
<option value="<?= $level_key ?>" <?= $level_key === $alert_level ? 'selected' : '' ?>><?= escapeHtml($level_label) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('alert_level') ?>
|
||||
<div class="form-text">A new alert on a device of a linked <?= $words['client'] ?> opens a ticket on its asset - High for an error, Medium for a warning, Low for the rest - and the same alert again goes on that ticket while it is open. When the alert clears, the ticket is resolved unless someone has written on it. Alerts already open when this is turned on don't open tickets.
|
||||
<span data-rmm-alerts-help><?= escapeHtml((string) ($kind['alerts_help'] ?? '')) ?></span></div>
|
||||
</div>
|
||||
<div class="mb-3 <?= $alert_level === '' ? 'd-none' : '' ?>" data-rmm-alert-more>
|
||||
<label class="form-label" for="rmmProviderAlertCategory">Ticket 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="alert_category_id" id="rmmProviderAlertCategory">
|
||||
<option value="0">- Not categorized -</option>
|
||||
<?= categoryOptionsHtml('Ticket', $alert_category_id ?: null) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Ticket') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (rmmAssetTypesReady()) {
|
||||
$device_types = rmmProviderAssetTypes($row, $kind); ?>
|
||||
<div class="mb-3" data-rmm-asset-types>
|
||||
<label class="form-label">Asset types</label>
|
||||
<div class="row g-2">
|
||||
<?php foreach (rmmDeviceKinds($kind) as $guessed => $kind_label) {
|
||||
$type_id = 'rmmProviderType' . str_replace(' ', '', $guessed); ?>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label small text-body-secondary mb-1" for="<?= $type_id ?>"><?= escapeHtml($kind_label) ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw <?= escapeHtml(assetTypeInfo($guessed)['icon']) ?>"></i></span>
|
||||
<select class="form-select select2" name="asset_types[<?= escapeHtml($guessed) ?>]" id="<?= $type_id ?>">
|
||||
<?php foreach (assetTypePicker($device_types[$guessed]) as $type_name => $type_icon) { ?>
|
||||
<option <?= $type_name === $device_types[$guessed] ? 'selected' : '' ?><?= selectOptionData(['icon' => "fas $type_icon"]) ?>><?= escapeHtml($type_name) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<div class="form-text"><?= escapeHtml($about['help']) ?>
|
||||
<?php if ($secret && $info['docs_url'] !== '') { ?><a href="<?= escapeHtml($info['docs_url']) ?>" target="_blank" rel="noopener noreferrer"><?= escapeHtml($info['short']) ?>'s API keys <i class="fas fa-external-link-alt fa-xs"></i></a><?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?= $error_for('asset_types') ?>
|
||||
<div class="form-text">What its devices come in as. A device the sync typed follows a change here at the next sync; one whose type you changed on the asset keeps yours.<?= $family === 'rmm' ? ' Recurring invoice lines that count managed devices by type count these.' : '' ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($alerts_offered) { ?>
|
||||
<!-- Whether its alerts open tickets, and in which category -->
|
||||
<div class="tab-pane fade" id="rmmProviderAlerts">
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="rmmProviderAlertLevel">Alerts open tickets</label>
|
||||
<div class="input-group has-validation">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-bell"></i></span>
|
||||
<select class="form-select select2" name="alert_level" id="rmmProviderAlertLevel" data-rmm-alert-level>
|
||||
<?php foreach (rmmAlertLevels() as $level_key => $level_label) { ?>
|
||||
<option value="<?= $level_key ?>" <?= $level_key === $alert_level ? 'selected' : '' ?>><?= escapeHtml($level_label) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?= $error_for('alert_level') ?>
|
||||
<div class="form-text">A new alert on a device of a linked <?= $words['client'] ?> opens a ticket on its asset - High for an error, Medium for a warning, Low for the rest - and the same alert again goes on that ticket while it is open. When the alert clears, the ticket is resolved unless someone has written on it. Alerts already open when this is turned on don't open tickets.
|
||||
<span data-rmm-alerts-help><?= escapeHtml((string) ($kind['alerts_help'] ?? '')) ?></span></div>
|
||||
</div>
|
||||
<div class="mb-3 <?= $alert_level === '' ? 'd-none' : '' ?>" data-rmm-alert-more>
|
||||
<label class="form-label" for="rmmProviderAlertCategory">Ticket 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="alert_category_id" id="rmmProviderAlertCategory">
|
||||
<option value="0">- Not categorized -</option>
|
||||
<?= categoryOptionsHtml('Ticket', $alert_category_id ?: null) ?>
|
||||
</select>
|
||||
<?= categoryAddButtonHtml('Ticket') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (rmmAssetTypesReady()) {
|
||||
$device_types = rmmProviderAssetTypes($row, $kind); ?>
|
||||
<!-- What each kind of device comes in as -->
|
||||
<div class="tab-pane fade" id="rmmProviderAssetTypes">
|
||||
<div class="mb-3" data-rmm-asset-types>
|
||||
<div class="row g-2">
|
||||
<?php foreach (rmmDeviceKinds($kind) as $guessed => $kind_label) {
|
||||
$type_id = 'rmmProviderType' . str_replace(' ', '', $guessed); ?>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-label small text-body-secondary mb-1" for="<?= $type_id ?>"><?= escapeHtml($kind_label) ?></label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw <?= escapeHtml(assetTypeInfo($guessed)['icon']) ?>"></i></span>
|
||||
<select class="form-select select2" name="asset_types[<?= escapeHtml($guessed) ?>]" id="<?= $type_id ?>">
|
||||
<?php foreach (assetTypePicker($device_types[$guessed]) as $type_name => $type_icon) { ?>
|
||||
<option <?= $type_name === $device_types[$guessed] ? 'selected' : '' ?><?= selectOptionData(['icon' => "fas $type_icon"]) ?>><?= escapeHtml($type_name) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?= $error_for('asset_types') ?>
|
||||
<div class="form-text">What its devices come in as. A device the sync typed follows a change here at the next sync; one whose type you changed on the asset keeps yours.<?= $family === 'rmm' ? ' Recurring invoice lines that count managed devices by type count these.' : '' ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" name="<?= $row ? 'edit_rmm_provider' : 'add_rmm_provider' ?>" class="btn btn-primary fw-bold" data-rmm-provider-save>
|
||||
@@ -231,11 +256,14 @@ ob_start();
|
||||
block.classList.toggle('d-none', !shown);
|
||||
block.querySelectorAll('input').forEach(function (input) { input.disabled = !shown; });
|
||||
});
|
||||
// Alerts only for a kind that has them
|
||||
// Alerts only for a kind that has them - its tab goes, back to Connection if it was open
|
||||
var alerts = form.querySelector('[data-rmm-alerts]');
|
||||
if (alerts) {
|
||||
alerts.classList.toggle('d-none', !kinds[kind].alerts);
|
||||
alerts.querySelector('[data-rmm-alerts-help]').textContent = kinds[kind].alertsHelp;
|
||||
form.querySelector('[data-rmm-alerts-help]').textContent = kinds[kind].alertsHelp;
|
||||
if (!kinds[kind].alerts && alerts.querySelector('.nav-link.active') && window.bootstrap) {
|
||||
bootstrap.Tab.getOrCreateInstance(form.querySelector('[href="#rmmProviderConnection"]')).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -263,6 +291,7 @@ ob_start();
|
||||
}
|
||||
function showErrors(errors) {
|
||||
var first = null;
|
||||
var firstBox = null;
|
||||
Object.keys(errors).forEach(function (field) {
|
||||
var input = find(field, 'input');
|
||||
var box = find(field, 'box');
|
||||
@@ -273,8 +302,13 @@ ob_start();
|
||||
if (box) {
|
||||
box.textContent = errors[field];
|
||||
box.classList.add('d-block');
|
||||
firstBox = firstBox || box;
|
||||
}
|
||||
});
|
||||
// Its tab opened - a field's, or where the message is when it has no field of its own (Asset types)
|
||||
if (window.itflowRevealTab) {
|
||||
window.itflowRevealTab(first || firstBox);
|
||||
}
|
||||
if (first) {
|
||||
first.focus();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
/*
|
||||
* A ticket status's fields - for ticket_status_add.php and
|
||||
* ticket_status_edit.php, which set $ticket_status (a ticketStatusRow(), or
|
||||
* null when new). A built-in status keeps its name and has a fixed answer for
|
||||
* null when new). Under the preview of its badge, two tabs: Details (name,
|
||||
* description, color) and What it does (the SLA clock, a client's reply, the
|
||||
* first response). A built-in status keeps its name and has a fixed answer for
|
||||
* the SLA clock - shown, not asked; a client's reply moves a ticket in one
|
||||
* back to Open or to a status picked, and Closed takes none. The preview of its
|
||||
* badge and the colour swatches are js/ticket_status_form.js. The server
|
||||
@@ -43,101 +45,120 @@ $s_reply_value = $s_reply_to && isset($s_reply_choices["to-$s_reply_to"]) ? "to-
|
||||
<span data-ticket-status-preview><?= ticketStatusBadgeHtml($s_name !== '' ? $s_name : 'New status', $s_color, 'list') ?></span>
|
||||
</div>
|
||||
|
||||
<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-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" placeholder="Waiting on Vendor, Scheduled, Parts Ordered" value="<?= escapeHtml($s_name) ?>" required<?= $s_builtin ? ' readonly' : ($s ? '' : ' autofocus') ?> data-ticket-status-name>
|
||||
</div>
|
||||
<?php if ($s_builtin) { ?>
|
||||
<div class="form-text"><i class="fas fa-fw fa-lock me-1"></i>ITFlow's own statuses keep their names. <?= escapeHtml($s_builtin['set_by']) ?></div>
|
||||
<?php } ?>
|
||||
</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="#ticketStatusFormDetails<?= $s_id ?>"><i class="fas fa-fw fa-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="#ticketStatusFormDoes<?= $s_id ?>"><i class="fas fa-fw fa-cogs me-2 d-none d-lg-inline"></i>What it does</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="255" placeholder="<?= escapeHtml($s_builtin ? $s_builtin['about'] : 'What it means, and when to use it') ?>" value="<?= escapeHtml($s_description) ?>">
|
||||
</div>
|
||||
<div class="form-text">Shown when the status is hovered - in the pickers, on the board and on tickets.</div>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Color</label>
|
||||
<input type="hidden" name="color" value="<?= $s_color ?>" data-ticket-status-color>
|
||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
||||
<div class="d-flex flex-wrap gap-1" role="group" aria-label="Colors">
|
||||
<?php foreach (CATEGORY_COLORS as $swatch) { ?>
|
||||
<button type="button" class="itflow-tag-swatch<?= $swatch === $s_color ? ' active' : '' ?>" style="--itflow-tag-color: <?= $swatch ?>; --itflow-tag-text: <?= tagTextColor($swatch) ?>" data-ticket-status-swatch="<?= $swatch ?>" title="<?= $swatch ?>" aria-label="Color <?= $swatch ?>" aria-pressed="<?= $swatch === $s_color ? 'true' : 'false' ?>"><i class="fas fa-check" aria-hidden="true"></i></button>
|
||||
<!-- Its name, what it means, its color -->
|
||||
<div class="tab-pane fade show active" id="ticketStatusFormDetails<?= $s_id ?>">
|
||||
<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-tag"></i></span>
|
||||
<input type="text" class="form-control" name="name" maxlength="200" placeholder="Waiting on Vendor, Scheduled, Parts Ordered" value="<?= escapeHtml($s_name) ?>" required<?= $s_builtin ? ' readonly' : ($s ? '' : ' autofocus') ?> data-ticket-status-name>
|
||||
</div>
|
||||
<?php if ($s_builtin) { ?>
|
||||
<div class="form-text"><i class="fas fa-fw fa-lock me-1"></i>ITFlow's own statuses keep their names. <?= escapeHtml($s_builtin['set_by']) ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group input-group-sm w-auto" title="Any other color">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-paint-brush"></i></span>
|
||||
<input type="color" class="form-control form-control-color" value="<?= $s_color ?>" aria-label="Custom color" data-ticket-status-color-pick>
|
||||
<input type="text" class="form-control font-monospace" style="width: 6rem" maxlength="7" value="<?= $s_color ?>" pattern="#?[0-9a-fA-F]{6}" aria-label="Color as hex" data-ticket-status-color-hex>
|
||||
|
||||
<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="255" placeholder="<?= escapeHtml($s_builtin ? $s_builtin['about'] : 'What it means, and when to use it') ?>" value="<?= escapeHtml($s_description) ?>">
|
||||
</div>
|
||||
<div class="form-text">Shown when the status is hovered - in the pickers, on the board and on tickets.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Color</label>
|
||||
<input type="hidden" name="color" value="<?= $s_color ?>" data-ticket-status-color>
|
||||
<div class="d-flex flex-wrap align-items-center gap-2">
|
||||
<div class="d-flex flex-wrap gap-1" role="group" aria-label="Colors">
|
||||
<?php foreach (CATEGORY_COLORS as $swatch) { ?>
|
||||
<button type="button" class="itflow-tag-swatch<?= $swatch === $s_color ? ' active' : '' ?>" style="--itflow-tag-color: <?= $swatch ?>; --itflow-tag-text: <?= tagTextColor($swatch) ?>" data-ticket-status-swatch="<?= $swatch ?>" title="<?= $swatch ?>" aria-label="Color <?= $swatch ?>" aria-pressed="<?= $swatch === $s_color ? 'true' : 'false' ?>"><i class="fas fa-check" aria-hidden="true"></i></button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group input-group-sm w-auto" title="Any other color">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-paint-brush"></i></span>
|
||||
<input type="color" class="form-control form-control-color" value="<?= $s_color ?>" aria-label="Custom color" data-ticket-status-color-pick>
|
||||
<input type="text" class="form-control font-monospace" style="width: 6rem" maxlength="7" value="<?= $s_color ?>" pattern="#?[0-9a-fA-F]{6}" aria-label="Color as hex" data-ticket-status-color-hex>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">SLA resolution clock</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-stopwatch"></i></span>
|
||||
<?php if ($s_builtin) { ?>
|
||||
<input type="text" class="form-control" value="<?= $s_id === TICKET_STATUS_CLOSED ? 'Stopped - the ticket is finished' : ($s_paused ? 'Paused while a ticket is in it' : 'Keeps running') ?>" readonly>
|
||||
<?php } else { ?>
|
||||
<select class="form-select select2" name="pauses_sla">
|
||||
<option value="0"<?= $s_paused ? '' : ' selected' ?>>Keeps running - the ticket is being worked</option>
|
||||
<option value="1"<?= $s_paused ? ' selected' : '' ?>>Paused - waiting on someone else</option>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($s_builtin) { ?><i class="fas fa-fw fa-lock me-1"></i>Fixed for ITFlow's own statuses. <?php } ?>
|
||||
A ticket in a paused status never warns or breaches on resolution - the time already spent is kept, and the deadline moves out when it comes back. The response clock always runs.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="<?= $s_id && !ticketStatusCanBeFirstResponse($s_id) ? 'mb-1' : 'mb-3' ?>">
|
||||
<label class="form-label">When the client replies</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-reply"></i></span>
|
||||
<?php if ($s_id === TICKET_STATUS_CLOSED || ($s_builtin && !ticketStatusReplyReady())) { ?>
|
||||
<input type="text" class="form-control" value="<?= [TICKET_STATUS_OPEN => 'It stays Open', TICKET_STATUS_RESOLVED => 'It is reopened - back to Open', TICKET_STATUS_CLOSED => 'They can\'t - they are told to raise a new ticket'][$s_id] ?? 'It moves back to Open' ?>" readonly>
|
||||
<?php } else { ?>
|
||||
<select class="form-select select2" name="client_reply">
|
||||
<?php foreach ($s_reply_choices as $value => $label) { ?>
|
||||
<option value="<?= escapeHtml($value) ?>"<?= (string) $value === $s_reply_value ? ' selected' : '' ?>><?= escapeHtml($label) ?></option>
|
||||
<!-- The SLA clock, a client's reply, the first response -->
|
||||
<div class="tab-pane fade" id="ticketStatusFormDoes<?= $s_id ?>">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">SLA resolution clock</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-stopwatch"></i></span>
|
||||
<?php if ($s_builtin) { ?>
|
||||
<input type="text" class="form-control" value="<?= $s_id === TICKET_STATUS_CLOSED ? 'Stopped - the ticket is finished' : ($s_paused ? 'Paused while a ticket is in it' : 'Keeps running') ?>" readonly>
|
||||
<?php } else { ?>
|
||||
<select class="form-select select2" name="pauses_sla">
|
||||
<option value="0"<?= $s_paused ? '' : ' selected' ?>>Keeps running - the ticket is being worked</option>
|
||||
<option value="1"<?= $s_paused ? ' selected' : '' ?>>Paused - waiting on someone else</option>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($s_id === TICKET_STATUS_CLOSED) { ?>
|
||||
<i class="fas fa-fw fa-lock me-1"></i>A closed ticket takes no replies.
|
||||
<?php } else { ?>
|
||||
By email, in the portal or by text. Move it to a status such as "Client responded" to see at a glance which tickets have a new answer; back to Open suits a status that waits on the client<?= $s_builtin ? '' : '; leave it for one like Scheduled, where a "thanks, see you then" shouldn\'t put it back in the queue' ?>. Whoever it is assigned to is told either way.
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($s_builtin) { ?><i class="fas fa-fw fa-lock me-1"></i>Fixed for ITFlow's own statuses. <?php } ?>
|
||||
A ticket in a paused status never warns or breaches on resolution - the time already spent is kept, and the deadline moves out when it comes back. The response clock always runs.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (ticketStatusReplyReady() && (!$s_id || ticketStatusCanBeFirstResponse($s_id))) { ?>
|
||||
<div class="mb-1">
|
||||
<label class="form-label">Counts as the first response</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-comment-dots"></i></span>
|
||||
<select class="form-select select2" name="first_response">
|
||||
<?php foreach (TICKET_STATUS_FIRST_RESPONSE as $value => $first_response) { ?>
|
||||
<option value="<?= $value ?>"<?= $value === $s_first_response ? ' selected' : '' ?>><?= escapeHtml($first_response['label']) ?></option>
|
||||
<div class="<?= $s_id && !ticketStatusCanBeFirstResponse($s_id) ? 'mb-1' : 'mb-3' ?>">
|
||||
<label class="form-label">When the client replies</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-reply"></i></span>
|
||||
<?php if ($s_id === TICKET_STATUS_CLOSED || ($s_builtin && !ticketStatusReplyReady())) { ?>
|
||||
<input type="text" class="form-control" value="<?= [TICKET_STATUS_OPEN => 'It stays Open', TICKET_STATUS_RESOLVED => 'It is reopened - back to Open', TICKET_STATUS_CLOSED => 'They can\'t - they are told to raise a new ticket'][$s_id] ?? 'It moves back to Open' ?>" readonly>
|
||||
<?php } else { ?>
|
||||
<select class="form-select select2" name="client_reply">
|
||||
<?php foreach ($s_reply_choices as $value => $label) { ?>
|
||||
<option value="<?= escapeHtml($value) ?>"<?= (string) $value === $s_reply_value ? ' selected' : '' ?>><?= escapeHtml($label) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
An agent moving a ticket into this status before anyone has answered the client meets - or misses - the SLA's response target then: setting it by hand or in a reply, or assigning a new ticket, which moves it to Open. Once per ticket. With the email, the contact and watchers get the "ticket assigned" message from <a href="settings_ticket.php#messages">Settings > Tickets</a>, kept on the ticket as a public note; if nobody could be emailed, it doesn't count.
|
||||
</div>
|
||||
<div class="form-text">
|
||||
<?php if ($s_id === TICKET_STATUS_CLOSED) { ?>
|
||||
<i class="fas fa-fw fa-lock me-1"></i>A closed ticket takes no replies.
|
||||
<?php } else { ?>
|
||||
By email, in the portal or by text. Move it to a status such as "Client responded" to see at a glance which tickets have a new answer; back to Open suits a status that waits on the client<?= $s_builtin ? '' : '; leave it for one like Scheduled, where a "thanks, see you then" shouldn\'t put it back in the queue' ?>. Whoever it is assigned to is told either way.
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (ticketStatusReplyReady() && (!$s_id || ticketStatusCanBeFirstResponse($s_id))) { ?>
|
||||
<div class="mb-1">
|
||||
<label class="form-label">Counts as the first response</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-comment-dots"></i></span>
|
||||
<select class="form-select select2" name="first_response">
|
||||
<?php foreach (TICKET_STATUS_FIRST_RESPONSE as $value => $first_response) { ?>
|
||||
<option value="<?= $value ?>"<?= $value === $s_first_response ? ' selected' : '' ?>><?= escapeHtml($first_response['label']) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-text">
|
||||
An agent moving a ticket into this status before anyone has answered the client meets - or misses - the SLA's response target then: setting it by hand or in a reply, or assigning a new ticket, which moves it to Open. Once per ticket. With the email, the contact and watchers get the "ticket assigned" message from <a href="settings_ticket.php#messages">Settings > Tickets</a>, kept on the ticket as a public note; if nobody could be emailed, it doesn't count.
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="<?= staticFileUrl('/js/ticket_status_form.js') ?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user