|
|
|
|
@@ -125,20 +125,26 @@ $tenantIsOAuth2 = $tenantAuthMode === HelpdeskSettingsGateway::AUTH_MODE_OAUTH2;
|
|
|
|
|
<?php Session::getCsrfInput(); ?>
|
|
|
|
|
<input type="hidden" name="save_target" value="global" id="helpdesk-settings-save-target">
|
|
|
|
|
|
|
|
|
|
<div class="app-tabs" data-tabs data-app-component="tabs" data-tabs-param="tab" data-tabs-storage-key="helpdesk-settings-tabs-v2">
|
|
|
|
|
<div class="app-tabs" data-tabs data-app-component="tabs" data-tabs-param="tab" data-tabs-storage-key="helpdesk-settings-tabs-v3">
|
|
|
|
|
<div class="app-tabs-nav">
|
|
|
|
|
<button type="button" data-tab="connection" data-tab-default><?php e(t('Connection')); ?></button>
|
|
|
|
|
<button type="button" data-tab="auth"><?php e(t('Authentication')); ?></button>
|
|
|
|
|
<button type="button" data-tab="automation"><?php e(t('Automation')); ?></button>
|
|
|
|
|
<button type="button" data-tab="global" data-tab-default><?php e(t('General connection')); ?></button>
|
|
|
|
|
<?php if ($currentTenantId > 0): ?>
|
|
|
|
|
<button type="button" data-tab="tenant"><?php e(t('Tenant override')); ?></button>
|
|
|
|
|
<button type="button" data-tab="tenant"><?php e(t('Tenant connection')); ?></button>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<button type="button" data-tab="automation"><?php e(t('Automation')); ?></button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div data-tab-panel="connection" class="helpdesk-settings-panel">
|
|
|
|
|
<details class="app-details-card" name="helpdesk-odata" data-details-key="helpdesk-settings-odata" open>
|
|
|
|
|
<!-- ═══════════════ GLOBAL TAB ═══════════════ -->
|
|
|
|
|
<div data-tab-panel="global" class="helpdesk-settings-panel">
|
|
|
|
|
<?php if ($currentTenantId > 0 && $tenantOverrideEnabled): ?>
|
|
|
|
|
<div class="notice" data-variant="info" role="status">
|
|
|
|
|
<p><?php e(t('The current tenant uses its own configuration. Changes here only affect tenants without a tenant-specific connection.')); ?></p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<details class="app-details-card" name="helpdesk-global-connection" data-details-key="helpdesk-settings-global-connection" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('OData connection')); ?></span>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Connection')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="odata_base_url">
|
|
|
|
|
@@ -167,7 +173,62 @@ $tenantIsOAuth2 = $tenantAuthMode === HelpdeskSettingsGateway::AUTH_MODE_OAUTH2;
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details class="app-details-card" name="helpdesk-connection-test" data-details-key="helpdesk-settings-connection-test" open>
|
|
|
|
|
<details class="app-details-card" name="helpdesk-global-auth" data-details-key="helpdesk-settings-global-auth" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Authentication')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="auth_mode">
|
|
|
|
|
<span><?php e(t('Auth mode')); ?></span>
|
|
|
|
|
<select id="auth_mode" name="auth_mode">
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_BASIC); ?>" <?php if (!$isOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('Basic Auth')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_OAUTH2); ?>" <?php if ($isOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('OAuth2 (client credentials)')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-basic-auth-fields" class="helpdesk-settings-rule-grid" <?php if ($isOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="basic_user">
|
|
|
|
|
<span><?php e(t('Username')); ?></span>
|
|
|
|
|
<input type="text" id="basic_user" name="basic_user" value="<?php e($basicUser); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="basic_password">
|
|
|
|
|
<span><?php e(t('Password')); ?></span>
|
|
|
|
|
<input type="password" id="basic_password" name="basic_password" value="" placeholder="<?php if ($hasBasicPassword): ?><?php e(t('Saved')); ?><?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($hasBasicPassword): ?>
|
|
|
|
|
<small><?php e(t('Leave empty to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-oauth2-fields" class="helpdesk-settings-rule-grid" <?php if (!$isOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="oauth_tenant_id">
|
|
|
|
|
<span><?php e(t('Azure Tenant ID')); ?></span>
|
|
|
|
|
<input type="text" id="oauth_tenant_id" name="oauth_tenant_id" value="<?php e($oauthTenantId); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="oauth_client_id">
|
|
|
|
|
<span><?php e(t('Client ID')); ?></span>
|
|
|
|
|
<input type="text" id="oauth_client_id" name="oauth_client_id" value="<?php e($oauthClientId); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="oauth_client_secret">
|
|
|
|
|
<span><?php e(t('Client Secret')); ?></span>
|
|
|
|
|
<input type="password" id="oauth_client_secret" name="oauth_client_secret" value="" placeholder="<?php if ($hasOAuthClientSecret): ?><?php e(t('Saved')); ?><?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($hasOAuthClientSecret): ?>
|
|
|
|
|
<small><?php e(t('Leave empty to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="oauth_token_endpoint">
|
|
|
|
|
<span><?php e(t('Token endpoint URL')); ?></span>
|
|
|
|
|
<input type="url" id="oauth_token_endpoint" name="oauth_token_endpoint" value="<?php e($oauthTokenEndpoint); ?>" placeholder="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token">
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details class="app-details-card" name="helpdesk-global-test" data-details-key="helpdesk-settings-global-test" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Connection test')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
@@ -186,113 +247,110 @@ $tenantIsOAuth2 = $tenantAuthMode === HelpdeskSettingsGateway::AUTH_MODE_OAUTH2;
|
|
|
|
|
</details>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div data-tab-panel="auth" class="helpdesk-settings-panel">
|
|
|
|
|
<details class="app-details-card" name="helpdesk-auth-mode" data-details-key="helpdesk-settings-auth-mode" open>
|
|
|
|
|
<!-- ═══════════════ TENANT TAB ═══════════════ -->
|
|
|
|
|
<?php if ($currentTenantId > 0): ?>
|
|
|
|
|
<div data-tab-panel="tenant" class="helpdesk-settings-panel">
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-override" data-details-key="helpdesk-settings-tenant-override" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Authentication')); ?></span>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Configuration source')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="auth_mode">
|
|
|
|
|
<span><?php e(t('Auth mode')); ?></span>
|
|
|
|
|
<select id="auth_mode" name="auth_mode">
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_BASIC); ?>" <?php if ($authMode === HelpdeskSettingsGateway::AUTH_MODE_BASIC): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('Basic Auth')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_OAUTH2); ?>" <?php if ($authMode === HelpdeskSettingsGateway::AUTH_MODE_OAUTH2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('OAuth2 (client credentials)')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
<label class="helpdesk-settings-rule">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
role="switch"
|
|
|
|
|
name="override_enabled"
|
|
|
|
|
id="helpdesk-override-toggle"
|
|
|
|
|
<?php if ($tenantOverrideEnabled): ?>checked<?php endif; ?>
|
|
|
|
|
>
|
|
|
|
|
<span class="helpdesk-settings-rule-label"><?php e(t('Use tenant-specific configuration')); ?></span>
|
|
|
|
|
<small><?php e(t('When enabled, this tenant uses its own BC connection instead of the global configuration.')); ?></small>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details id="helpdesk-basic-auth-fields" class="app-details-card" name="helpdesk-basic-auth" data-details-key="helpdesk-settings-basic-auth" <?php if ($isOAuth2): ?>hidden<?php else: ?>open<?php endif; ?>>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Basic Auth credentials')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container helpdesk-settings-rule-grid">
|
|
|
|
|
<label class="app-field" for="basic_user">
|
|
|
|
|
<span><?php e(t('Username')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="basic_user"
|
|
|
|
|
name="basic_user"
|
|
|
|
|
value="<?php e($basicUser); ?>"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
<div id="helpdesk-tenant-fields" <?php if (!$tenantOverrideEnabled): ?>hidden<?php endif; ?>>
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-connection" data-details-key="helpdesk-settings-tenant-connection" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Connection')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="tenant_odata_base_url">
|
|
|
|
|
<span><?php e(t('OData Base URL')); ?></span>
|
|
|
|
|
<input type="url" id="tenant_odata_base_url" name="tenant_odata_base_url" value="<?php e(trim((string) ($tenantRow['odata_base_url'] ?? ''))); ?>" placeholder="https://bc.example.com:7048/BusinessCentral/ODataV4">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_company_name">
|
|
|
|
|
<span><?php e(t('Company name')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_company_name" name="tenant_company_name" value="<?php e(trim((string) ($tenantRow['company_name'] ?? ''))); ?>">
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<label class="app-field" for="basic_password">
|
|
|
|
|
<span><?php e(t('Password')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
id="basic_password"
|
|
|
|
|
name="basic_password"
|
|
|
|
|
value="<?php if ($hasBasicPassword): ?>********<?php endif; ?>"
|
|
|
|
|
autocomplete="new-password"
|
|
|
|
|
>
|
|
|
|
|
<?php if ($hasBasicPassword): ?>
|
|
|
|
|
<small><?php e(t('Leave unchanged to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-auth" data-details-key="helpdesk-settings-tenant-auth" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Authentication')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="tenant_auth_mode">
|
|
|
|
|
<span><?php e(t('Auth mode')); ?></span>
|
|
|
|
|
<select id="tenant_auth_mode" name="tenant_auth_mode">
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_BASIC); ?>" <?php if (!$tenantIsOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('Basic Auth')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_OAUTH2); ?>" <?php if ($tenantIsOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('OAuth2 (client credentials)')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-tenant-basic-auth-fields" class="helpdesk-settings-rule-grid" <?php if ($tenantIsOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="tenant_basic_user">
|
|
|
|
|
<span><?php e(t('Username')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_basic_user" name="tenant_basic_user" value="<?php e(trim((string) ($tenantRow['basic_user'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_basic_password">
|
|
|
|
|
<span><?php e(t('Password')); ?></span>
|
|
|
|
|
<input type="password" id="tenant_basic_password" name="tenant_basic_password" value="" placeholder="<?php if ($tenantHasBasicPassword): ?><?php e(t('Saved')); ?><?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($tenantHasBasicPassword): ?>
|
|
|
|
|
<small><?php e(t('Leave empty to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-tenant-oauth2-fields" class="helpdesk-settings-rule-grid" <?php if (!$tenantIsOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_tenant_id">
|
|
|
|
|
<span><?php e(t('Azure Tenant ID')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_oauth_tenant_id" name="tenant_oauth_tenant_id" value="<?php e(trim((string) ($tenantRow['oauth_tenant_id'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_client_id">
|
|
|
|
|
<span><?php e(t('Client ID')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_oauth_client_id" name="tenant_oauth_client_id" value="<?php e(trim((string) ($tenantRow['oauth_client_id'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_client_secret">
|
|
|
|
|
<span><?php e(t('Client Secret')); ?></span>
|
|
|
|
|
<input type="password" id="tenant_oauth_client_secret" name="tenant_oauth_client_secret" value="" placeholder="<?php if ($tenantHasOAuthSecret): ?><?php e(t('Saved')); ?><?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($tenantHasOAuthSecret): ?>
|
|
|
|
|
<small><?php e(t('Leave empty to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_token_endpoint">
|
|
|
|
|
<span><?php e(t('Token endpoint URL')); ?></span>
|
|
|
|
|
<input type="url" id="tenant_oauth_token_endpoint" name="tenant_oauth_token_endpoint" value="<?php e(trim((string) ($tenantRow['oauth_token_endpoint'] ?? ''))); ?>" placeholder="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token">
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php if (!$tenantOverrideEnabled): ?>
|
|
|
|
|
<div class="notice" data-variant="info" role="status">
|
|
|
|
|
<p><?php e(t('This tenant inherits the global configuration. Enable the toggle above to use tenant-specific settings.')); ?></p>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details id="helpdesk-oauth2-fields" class="app-details-card" name="helpdesk-oauth2-auth" data-details-key="helpdesk-settings-oauth2-auth" <?php if (!$isOAuth2): ?>hidden<?php else: ?>open<?php endif; ?>>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('OAuth2 credentials')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container helpdesk-settings-rule-grid">
|
|
|
|
|
<label class="app-field" for="oauth_tenant_id">
|
|
|
|
|
<span><?php e(t('Azure Tenant ID')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="oauth_tenant_id"
|
|
|
|
|
name="oauth_tenant_id"
|
|
|
|
|
value="<?php e($oauthTenantId); ?>"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label class="app-field" for="oauth_client_id">
|
|
|
|
|
<span><?php e(t('Client ID')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="oauth_client_id"
|
|
|
|
|
name="oauth_client_id"
|
|
|
|
|
value="<?php e($oauthClientId); ?>"
|
|
|
|
|
autocomplete="off"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label class="app-field" for="oauth_client_secret">
|
|
|
|
|
<span><?php e(t('Client Secret')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="password"
|
|
|
|
|
id="oauth_client_secret"
|
|
|
|
|
name="oauth_client_secret"
|
|
|
|
|
value="<?php if ($hasOAuthClientSecret): ?>********<?php endif; ?>"
|
|
|
|
|
autocomplete="new-password"
|
|
|
|
|
>
|
|
|
|
|
<?php if ($hasOAuthClientSecret): ?>
|
|
|
|
|
<small><?php e(t('Leave unchanged to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label class="app-field" for="oauth_token_endpoint">
|
|
|
|
|
<span><?php e(t('Token endpoint URL')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="url"
|
|
|
|
|
id="oauth_token_endpoint"
|
|
|
|
|
name="oauth_token_endpoint"
|
|
|
|
|
value="<?php e($oauthTokenEndpoint); ?>"
|
|
|
|
|
placeholder="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<!-- ═══════════════ AUTOMATION TAB ═══════════════ -->
|
|
|
|
|
<div data-tab-panel="automation" class="helpdesk-settings-panel">
|
|
|
|
|
<details class="app-details-card" name="helpdesk-recommendations" data-details-key="helpdesk-settings-recommendations-v2" open>
|
|
|
|
|
<summary>
|
|
|
|
|
@@ -426,120 +484,6 @@ $tenantIsOAuth2 = $tenantAuthMode === HelpdeskSettingsGateway::AUTH_MODE_OAUTH2;
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php if ($currentTenantId > 0): ?>
|
|
|
|
|
<div data-tab-panel="tenant" class="helpdesk-settings-panel">
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-config-source" data-details-key="helpdesk-settings-tenant-source" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Configuration source')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="helpdesk-settings-rule">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
role="switch"
|
|
|
|
|
name="override_enabled"
|
|
|
|
|
id="helpdesk-override-toggle"
|
|
|
|
|
<?php if ($tenantOverrideEnabled): ?>checked<?php endif; ?>
|
|
|
|
|
>
|
|
|
|
|
<span class="helpdesk-settings-rule-label"><?php e(t('Use tenant-specific configuration')); ?></span>
|
|
|
|
|
<small><?php e(t('When enabled, this tenant uses its own BC connection instead of the global configuration.')); ?></small>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-tenant-fields" <?php if (!$tenantOverrideEnabled): ?>hidden<?php endif; ?>>
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-connection" data-details-key="helpdesk-settings-tenant-connection" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Tenant connection')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="tenant_odata_base_url">
|
|
|
|
|
<span><?php e(t('OData Base URL')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="url"
|
|
|
|
|
id="tenant_odata_base_url"
|
|
|
|
|
name="tenant_odata_base_url"
|
|
|
|
|
value="<?php e(trim((string) ($tenantRow['odata_base_url'] ?? ''))); ?>"
|
|
|
|
|
placeholder="https://bc.example.com:7048/BusinessCentral/ODataV4"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<label class="app-field" for="tenant_company_name">
|
|
|
|
|
<span><?php e(t('Company name')); ?></span>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="tenant_company_name"
|
|
|
|
|
name="tenant_company_name"
|
|
|
|
|
value="<?php e(trim((string) ($tenantRow['company_name'] ?? ''))); ?>"
|
|
|
|
|
>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
|
|
<details class="app-details-card" name="helpdesk-tenant-auth" data-details-key="helpdesk-settings-tenant-auth" open>
|
|
|
|
|
<summary>
|
|
|
|
|
<span class="app-details-card-summary-title"><?php e(t('Tenant authentication')); ?></span>
|
|
|
|
|
</summary>
|
|
|
|
|
<div class="app-details-card-container">
|
|
|
|
|
<label class="app-field" for="tenant_auth_mode">
|
|
|
|
|
<span><?php e(t('Auth mode')); ?></span>
|
|
|
|
|
<select id="tenant_auth_mode" name="tenant_auth_mode">
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_BASIC); ?>" <?php if (!$tenantIsOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('Basic Auth')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
<option value="<?php e(HelpdeskSettingsGateway::AUTH_MODE_OAUTH2); ?>" <?php if ($tenantIsOAuth2): ?>selected<?php endif; ?>>
|
|
|
|
|
<?php e(t('OAuth2 (client credentials)')); ?>
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-tenant-basic-auth-fields" class="helpdesk-settings-rule-grid" <?php if ($tenantIsOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="tenant_basic_user">
|
|
|
|
|
<span><?php e(t('Username')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_basic_user" name="tenant_basic_user" value="<?php e(trim((string) ($tenantRow['basic_user'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_basic_password">
|
|
|
|
|
<span><?php e(t('Password')); ?></span>
|
|
|
|
|
<input type="password" id="tenant_basic_password" name="tenant_basic_password" value="<?php if ($tenantHasBasicPassword): ?>********<?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($tenantHasBasicPassword): ?>
|
|
|
|
|
<small><?php e(t('Leave unchanged to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="helpdesk-tenant-oauth2-fields" class="helpdesk-settings-rule-grid" <?php if (!$tenantIsOAuth2): ?>hidden<?php endif; ?>>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_tenant_id">
|
|
|
|
|
<span><?php e(t('Azure Tenant ID')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_oauth_tenant_id" name="tenant_oauth_tenant_id" value="<?php e(trim((string) ($tenantRow['oauth_tenant_id'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_client_id">
|
|
|
|
|
<span><?php e(t('Client ID')); ?></span>
|
|
|
|
|
<input type="text" id="tenant_oauth_client_id" name="tenant_oauth_client_id" value="<?php e(trim((string) ($tenantRow['oauth_client_id'] ?? ''))); ?>" autocomplete="off">
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_client_secret">
|
|
|
|
|
<span><?php e(t('Client Secret')); ?></span>
|
|
|
|
|
<input type="password" id="tenant_oauth_client_secret" name="tenant_oauth_client_secret" value="<?php if ($tenantHasOAuthSecret): ?>********<?php endif; ?>" autocomplete="new-password">
|
|
|
|
|
<?php if ($tenantHasOAuthSecret): ?>
|
|
|
|
|
<small><?php e(t('Leave unchanged to keep current password')); ?></small>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="app-field" for="tenant_oauth_token_endpoint">
|
|
|
|
|
<span><?php e(t('Token endpoint URL')); ?></span>
|
|
|
|
|
<input type="url" id="tenant_oauth_token_endpoint" name="tenant_oauth_token_endpoint" value="<?php e(trim((string) ($tenantRow['oauth_token_endpoint'] ?? ''))); ?>" placeholder="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token">
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</details>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php if (!$tenantOverrideEnabled): ?>
|
|
|
|
|
<div class="notice" data-variant="info" role="status">
|
|
|
|
|
<p><?php e(t('This tenant inherits the global configuration. Enable the toggle above to use tenant-specific settings.')); ?></p>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</section>
|
|
|
|
|
|