189 lines
11 KiB
PHP
189 lines
11 KiB
PHP
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?>
|
|
<?php echo st_get_admin_head('stPaypalPlugin', __('PayPal'), null,array('stPayment')) ?>
|
|
<?php st_view_slot_start('application-menu') ?>
|
|
<?php st_include_component('stPaypalBackend', 'listMenu') ?>
|
|
<?php st_view_slot_end() ?>
|
|
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels, 'i18n_catalogue' => 'stPaypalBackend')) ?>
|
|
<?php echo form_tag('stPaypalBackend/save', array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form', 'class' => 'admin_form')) ?>
|
|
<fieldset id="sf_fieldset-paypal-live">
|
|
<div class="content">
|
|
|
|
<div class="row">
|
|
<?php echo st_admin_get_form_field('config[enabled]', __('Aktywuj'), 1, 'checkbox_tag', array('checked' => $config->get('enabled'), 'class' => 'st_paypal-live-field', 'size' => '60')) ?>
|
|
<div class="clr"></div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<?php echo label_for('config_live_api_username', __('Nazwa użytkownika API'), array('class' => 'required')) ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{live_api_username}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{live_api_username}')): ?>
|
|
<?php echo form_error('config{live_api_username}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_tag('config[live_api_username]', $config->get('live_api_username'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
|
|
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_live_api_password', __('Hasło API'), array('class' => 'required')) ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{live_api_password}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{live_api_password}')): ?>
|
|
<?php echo form_error('config{live_api_password}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_password_tag('config[live_api_password]', $config->get('live_api_password'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_live_api_signature', __('Podpis API'), array('class' => 'required')) ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{live_api_signature}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{live_api_signature}')): ?>
|
|
<?php echo form_error('config{live_api_signature}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_password_tag('config[live_api_signature]', $config->get('live_api_signature'), array('disabled' => $config->get('test_mode'), 'class' => 'st_paypal-live-field', 'size' => 60)) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<?php if (SF_ENVIRONMENT == 'dev' || $sf_request->hasParameter('debug')): ?>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_enabled', __('Włącz')) ?>
|
|
<div class="content">
|
|
<?php echo st_admin_checkbox_tag('config[enabled]', true, $config->get('enabled')) ?>
|
|
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_test_mode', __('Tryb testowy')) ?>
|
|
<div class="content">
|
|
<?php echo st_admin_checkbox_tag('config[test_mode]', true, $config->get('test_mode')) ?>
|
|
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<?php endif ?>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_show_shipping_info', __('Pokaż dane dostawy').' <a href="#" class="help" title="'.__('Wyświetla dane dostawy na stronie potwierdzenia płatności PayPal').'"></a>') ?>
|
|
<div class="content">
|
|
<?php echo st_admin_checkbox_tag('config[show_shipping_info]', true, $config->get('show_shipping_info')) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset id="sf_fieldset-paypal-live">
|
|
<h2><?php echo __('PayPal Express') ?></h2>
|
|
<div class="content">
|
|
<div class="form-row">
|
|
<?php echo label_for('config_express', __('Aktywuj płatność na karcie produktu')) ?>
|
|
<div class="content">
|
|
<?php echo st_admin_checkbox_tag('config[express]', true, $config->get('express')) ?>
|
|
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_show_shipping_info', __('Domyślna dostawa'));?>
|
|
<div class="content">
|
|
<?php echo select_tag('config[express_delivery]', objects_for_select($deliveries, 'getId', 'getName', $config->get('express_delivery')));?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<?php if (SF_ENVIRONMENT == 'dev' || $sf_request->hasParameter('debug')): ?>
|
|
<fieldset id="sf_fieldset-paypal-sandbox">
|
|
<h2><?php echo __('Konfiguracja API (tryb testowy)') ?></h2>
|
|
<div class="content">
|
|
<div class="form-row">
|
|
<?php echo label_for('config_sandbox_api_username', __('Nazwa użytkownika API'), array('class' => 'required')); ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_username}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{sandbox_api_username}')): ?>
|
|
<?php echo form_error('config{sandbox_api_username}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_tag('config[sandbox_api_username]', $config->get('sandbox_api_username'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_sandbox_api_password', __('Hasło API'), array('class' => 'required')) ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_password}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{sandbox_api_password}')): ?>
|
|
<?php echo form_error('config{sandbox_api_password}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_password_tag('config[sandbox_api_password]', $config->get('sandbox_api_password'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<?php echo label_for('config_sandbox_api_signature', __('Podpis API'), array('class' => 'required')) ?>
|
|
|
|
<div class="content<?php if ($sf_request->hasError('config{sandbox_api_signature}')): ?> form-error<?php endif; ?>">
|
|
<?php if ($sf_request->hasError('config{sandbox_api_signature}')): ?>
|
|
<?php echo form_error('config{sandbox_api_signature}', array('class' => 'form-error-msg')) ?>
|
|
<?php endif; ?>
|
|
<?php echo input_password_tag('config[sandbox_api_signature]', $config->get('sandbox_api_signature'), array('disabled' => !$config->get('test_mode'), 'class' => 'st_paypal-sandbox-field', 'size' => 60)) ?>
|
|
<br class="st_clear_all"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<?php endif ?>
|
|
<?php if ($config->get('configuration_verified')): ?>
|
|
<fieldset id="sf_fieldset-paypal-account">
|
|
<h2><?php echo __('Informacje o koncie') ?></h2>
|
|
<div class="content">
|
|
<div class="form-row">
|
|
<div><?php echo __('Bilans konta') ?></div>
|
|
<div class="content" id="st_paypal-account-balance" style="margin-left: 15px;">
|
|
<?php echo image_tag('backend/stPaypalPlugin/ajax-loader.gif') ?>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div><?php echo __('Oczekujące płatności') ?>:</div>
|
|
<div class="content" id="st_paypal-pending-payments" style="margin-left: 15px;">
|
|
<?php echo image_tag('backend/stPaypalPlugin/ajax-loader.gif') ?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</fieldset>
|
|
<?php endif ?>
|
|
<?php echo st_get_admin_actions(array(
|
|
array('type' => 'save', 'label' => __('Zapisz', null, 'stAdminGeneratorPlugin'))
|
|
)) ?>
|
|
</form>
|
|
<div class="clr"></div>
|
|
<?php echo st_get_admin_foot();?>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function($) {
|
|
|
|
$('#config_test_mode').on('change', function() {
|
|
var input = $(this);
|
|
|
|
if (input.prop('checked'))
|
|
{
|
|
$('.st_paypal-sandbox-field').prop('disabled', false);
|
|
$('.st_paypal-live-field').prop('disabled', true);
|
|
}
|
|
else
|
|
{
|
|
$('.st_paypal-sandbox-field').prop('disabled', true);
|
|
$('.st_paypal-live-field').prop('disabled', false);
|
|
}
|
|
});
|
|
|
|
$.get('<?php echo url_for('stPaypalBackend/ajaxPaypalAccountBalance') ?>', function(response) {
|
|
$('#st_paypal-account-balance').html(response);
|
|
});
|
|
|
|
$.get('<?php echo url_for('stPaypalBackend/ajaxPaypalPendingPayments') ?>', function(response) {
|
|
$('#st_paypal-pending-payments').html(response);
|
|
});
|
|
});
|
|
</script>
|