- Create migration for global settings table and add google_ads_customer_id and google_ads_start_date columns to clients table. - Add migration to include product_url column in products_data table. - Insert demo data for campaigns, products, and their history for client 'pomysloweprezenty.pl'. - Implement client management interface with modals for adding and editing clients, including Google Ads Customer ID and data retrieval start date.
155 lines
8.0 KiB
PHP
155 lines
8.0 KiB
PHP
<div class="row">
|
|
<div class="col-12 col-md-6">
|
|
<div class="settings-card">
|
|
<div class="settings-card-header">
|
|
<div class="settings-card-icon"><i class="fa-solid fa-lock"></i></div>
|
|
<div>
|
|
<h3>Zmiana hasła</h3>
|
|
<small>Zmień swoje stare hasło na nowe</small>
|
|
</div>
|
|
</div>
|
|
<form method="POST" id="password-settings" action="/users/password_change/">
|
|
<div class="settings-field">
|
|
<label for="password_old">Stare hasło</label>
|
|
<div class="settings-input-wrap">
|
|
<i class="fa-solid fa-key settings-input-icon"></i>
|
|
<input type="password" id="password_old" name="password_old" class="form-control" required placeholder="Wprowadź stare hasło" />
|
|
<button type="button" class="settings-toggle-pw" onclick="password_toggle( this, 'password_old' )">
|
|
<i class="fa-solid fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="password_new">Nowe hasło</label>
|
|
<div class="settings-input-wrap">
|
|
<i class="fa-solid fa-key settings-input-icon"></i>
|
|
<input type="password" id="password_new" name="password_new" class="form-control" required placeholder="Wprowadź nowe hasło" />
|
|
<button type="button" class="settings-toggle-pw" onclick="password_toggle( this, 'password_new' )">
|
|
<i class="fa-solid fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-success"><i class="fa-solid fa-check mr5"></i>Zmień hasło</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" style="margin-top: 25px;">
|
|
<div class="col-12">
|
|
<div class="settings-card">
|
|
<div class="settings-card-header">
|
|
<div class="settings-card-icon"><i class="fa-brands fa-google"></i></div>
|
|
<div>
|
|
<h3>Google Ads API</h3>
|
|
<small>Dane do połączenia z Google Ads REST API (wymagane do synchronizacji kampanii)</small>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$last_error = \services\GoogleAdsApi::get_setting( 'google_ads_last_error' );
|
|
if ( $last_error ): ?>
|
|
<div class="settings-alert-error">
|
|
<i class="fa-solid fa-triangle-exclamation"></i>
|
|
<span><strong>Ostatni błąd API:</strong> <?= htmlspecialchars( $last_error ); ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
<form method="POST" id="google-ads-settings" action="/settings/save_google_ads">
|
|
<div class="settings-fields-grid">
|
|
<div class="settings-field">
|
|
<label for="google_ads_developer_token">Developer Token</label>
|
|
<input type="text" id="google_ads_developer_token" name="google_ads_developer_token" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'google_ads_developer_token' ) ); ?>" placeholder="np. ABcdEf1234..." />
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="google_ads_client_id">OAuth2 Client ID</label>
|
|
<input type="text" id="google_ads_client_id" name="google_ads_client_id" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'google_ads_client_id' ) ); ?>" placeholder="np. 123456789.apps.googleusercontent.com" />
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="google_ads_client_secret">OAuth2 Client Secret</label>
|
|
<div class="settings-input-wrap">
|
|
<input type="password" id="google_ads_client_secret" name="google_ads_client_secret" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'google_ads_client_secret' ) ); ?>" />
|
|
<button type="button" class="settings-toggle-pw" onclick="password_toggle( this, 'google_ads_client_secret' )">
|
|
<i class="fa-solid fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="google_ads_refresh_token">OAuth2 Refresh Token</label>
|
|
<div class="settings-input-wrap">
|
|
<input type="password" id="google_ads_refresh_token" name="google_ads_refresh_token" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'google_ads_refresh_token' ) ); ?>" />
|
|
<button type="button" class="settings-toggle-pw" onclick="password_toggle( this, 'google_ads_refresh_token' )">
|
|
<i class="fa-solid fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="google_ads_manager_account_id">Manager Account ID <span class="text-muted">(opcjonalnie, dla MCC)</span></label>
|
|
<input type="text" id="google_ads_manager_account_id" name="google_ads_manager_account_id" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'google_ads_manager_account_id' ) ); ?>" placeholder="np. 123-456-7890" />
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-success" onclick="$( '#google-ads-settings' ).submit();"><i class="fa-solid fa-check mr5"></i>Zapisz ustawienia Google Ads</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row" style="margin-top: 25px;">
|
|
<div class="col-12">
|
|
<div class="settings-card">
|
|
<div class="settings-card-header">
|
|
<div class="settings-card-icon"><i class="fa-solid fa-robot"></i></div>
|
|
<div>
|
|
<h3>OpenAI (ChatGPT)</h3>
|
|
<small>Klucz API i model do optymalizacji tytułów i opisów produktów przez AI</small>
|
|
</div>
|
|
</div>
|
|
<form method="POST" id="openai-settings" action="/settings/save_openai">
|
|
<div class="settings-fields-grid">
|
|
<div class="settings-field">
|
|
<label for="openai_api_key">API Key</label>
|
|
<div class="settings-input-wrap">
|
|
<input type="password" id="openai_api_key" name="openai_api_key" class="form-control" value="<?= htmlspecialchars( \services\GoogleAdsApi::get_setting( 'openai_api_key' ) ); ?>" placeholder="sk-..." />
|
|
<button type="button" class="settings-toggle-pw" onclick="password_toggle( this, 'openai_api_key' )">
|
|
<i class="fa-solid fa-eye"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="settings-field">
|
|
<label for="openai_model">Model</label>
|
|
<?php $current_model = \services\GoogleAdsApi::get_setting( 'openai_model' ) ?: 'gpt-5-mini'; ?>
|
|
<select id="openai_model" name="openai_model" class="form-control">
|
|
<option value="gpt-5.2" <?= $current_model === 'gpt-5.2' ? 'selected' : ''; ?>>GPT-5.2 (najnowszy, $1.75/$14 per 1M)</option>
|
|
<option value="gpt-5-mini" <?= $current_model === 'gpt-5-mini' ? 'selected' : ''; ?>>GPT-5 Mini (szybki, $0.25/$2 per 1M)</option>
|
|
<option value="gpt-4.1" <?= $current_model === 'gpt-4.1' ? 'selected' : ''; ?>>GPT-4.1</option>
|
|
<option value="gpt-4.1-mini" <?= $current_model === 'gpt-4.1-mini' ? 'selected' : ''; ?>>GPT-4.1 Mini</option>
|
|
<option value="gpt-4o" <?= $current_model === 'gpt-4o' ? 'selected' : ''; ?>>GPT-4o (legacy)</option>
|
|
<option value="gpt-4o-mini" <?= $current_model === 'gpt-4o-mini' ? 'selected' : ''; ?>>GPT-4o Mini (legacy)</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-success" onclick="$( '#openai-settings' ).submit();"><i class="fa-solid fa-check mr5"></i>Zapisz ustawienia OpenAI</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
function password_toggle( btn, id )
|
|
{
|
|
var icon = btn.querySelector( 'i' );
|
|
var input = document.getElementById( id );
|
|
|
|
if ( input.type === 'password' )
|
|
{
|
|
input.type = 'text';
|
|
icon.classList.remove( 'fa-eye' );
|
|
icon.classList.add( 'fa-eye-slash' );
|
|
}
|
|
else
|
|
{
|
|
input.type = 'password';
|
|
icon.classList.remove( 'fa-eye-slash' );
|
|
icon.classList.add( 'fa-eye' );
|
|
}
|
|
}
|
|
</script>
|