Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2165

Přidáno uživatelem Ondřej Fibich před asi 11 roky(ů)

Opravy:
- closes #748: Kalkulator - pocita prilis dlouho
- oprava velikosti ikon v profilu clena

Zobrazit rozdíly:

freenetis/branches/1.1/application/controllers/transfers.php
$form->input('amount')
->rules('valid_numeric')
->callback(array($this, 'valid_calculator_item'));
->callback(array($this, 'valid_calculator_item'))
->maxlength('4');
$form->input('expiration_date')
->label('Payed to')
->class('date')
->class('dateISO')
->callback(array($this, 'valid_calculator_item'));
$form->submit('Calculate');
freenetis/branches/1.1/application/views/js/transfers_payment_calculator.php
*/
// IDE complementation
if (FALSE): ?><script type="text/javascript"><?php endif
if (FALSE): ?><script type='text/javascript'><?php endif
?>
var add_base_url = '<?php echo url_lang::base() ?>transfers/add_member_fee_payment_by_cash/<?php echo $member_id ?>';
?>
$('#calculate').parent().parent().hide();
$('.form button[type=submit]').hide();
$("#calculate").parent().parent().hide();
$(".form button[type=submit]").hide();
$(".form").submit(function (){
$('.form').submit(function ()
{
return false;
});
var transfer_payment_calculator_cache = {expiration_date:'', amount:''};
$("#amount, #expiration_date").live('keyup', function (){
$('#amount, #expiration_date').live('keyup', function ()
{
var calculate, amount, expiration_date;
$.ajaxSetup({ async: false });
if (this.id == 'amount')
if (this.id === 'amount')
{
calculate = 'expiration_date';
amount = parseFloat($("#amount").val());
expiration_date = "";
calculate = 'expiration_date';
amount = parseFloat($('#amount').val());
expiration_date = '';
}
else
{
calculate = 'amount';
expiration_date = $("#expiration_date").val();
amount = "";
calculate = 'amount';
expiration_date = $('#expiration_date').val();
amount = '';
}
if ((calculate == 'expiration_date' && amount != "") || (calculate == 'amount' && expiration_date != ""))
if ((calculate === 'expiration_date' && amount !== '' && !isNaN(amount)) ||
(calculate === 'amount' && /^[0-9]{4}\-[0-9]{1,2}\-[0-9]{1,2}$/.test(expiration_date)))
{
$.post('<?php echo url_lang::base() ?>transfers/payment_calculator/<?php echo $account_id ?>/1', {calculate: calculate, amount: amount, expiration_date: expiration_date}, function (data){
$("#"+calculate).val(data);
if (calculate === 'amount')
{
if (transfer_payment_calculator_cache[calculate] === expiration_date) return;
transfer_payment_calculator_cache[calculate] = expiration_date;
}
else
{
if (transfer_payment_calculator_cache[calculate] === amount) return;
transfer_payment_calculator_cache[calculate] = amount;
}
$.ajax({
type: 'POST',
url: '<?php echo url_lang::base() ?>transfers/payment_calculator/<?php echo $account_id ?>/1',
data: {calculate: calculate, amount: amount, expiration_date: expiration_date},
success: function (data) {
$('#'+calculate).val(data);
},
error: function () {
$('#'+calculate).val('');
alert('<?php echo __('Error during obtaining data from server') ?>');
},
dataType: 'html',
async: false
});
}
$(".add_link").attr('href', add_base_url+'/'+parseFloat($("#amount").val()))
else
{
$('#'+calculate).val('');
}
$('.add_link').attr('href', '<?php echo url_lang::base() ?>transfers/add_member_fee_payment_by_cash/<?php echo $member_id ?>/'+parseFloat($('#amount').val()))
});
<?php if ($can_add): ?>
$("#amount", context).css('width', parseInt($("#amount", context).css('width'))-23);
$("<a href="+add_base_url+" class='add_link popup_link'><img class='purse' src='<?php echo url::base() ?>media/images/icons/purse.png'></a>").insertAfter($("#amount", context));
$('#amount', context).css('width', parseInt($('#amount', context).css('width'))-23);
$('<a href="<?php echo url_lang::base() ?>transfers/add_member_fee_payment_by_cash/<?php echo $member_id ?>" class="add_link popup_link"><img class="purse" src="<?php echo url::base() ?>media/images/icons/purse.png" width="16" height="16"></a>').insertAfter($('#amount', context));
<?php endif ?>
freenetis/branches/1.1/application/views/members/show.php
echo "<span class='".$class."' title='".$comments."'>".number_format((float) $account->balance, 2, ',', ' ').' '.$this->settings->get('currency')."</span> ";
if ($this->acl_check_new('Accounts_Controller', 'transfers'))
echo html::anchor(url_lang::base().'transfers/add_member_fee_payment_by_cash/'.$member->id, html::image(array('src' => url::base().'media/images/icons/purse.png')), array('title' => __('Add member fee payment by cash'), 'class' => 'action-icon popup_link'));
echo html::anchor(url_lang::base().'transfers/add_member_fee_payment_by_cash/'.$member->id, html::image(array('src' => url::base().'media/images/icons/purse.png', 'width' => 16, 'height' => 16)), array('title' => __('Add member fee payment by cash'), 'class' => 'action-icon popup_link'));
echo html::anchor('transfers/payment_calculator/'.$account->id, html::image(array('src' => url::base().'media/images/icons/calculate.png')), array('title' => __('Calculate'), 'class' => 'action-icon popup_link'));
if ($this->acl_check_view ('Members_Controller','comment',$member->id))
echo html::anchor(($account->comments_thread_id ? (url_lang::base().'comments/add/'.$account->comments_thread_id) : (url_lang::base().'comments_threads/add/account/'.$account->id)), html::image(array('src' => url::base().'media/images/icons/comment_add.png')), array('title' => __('Add comment to financial state of member'), 'class' => 'action-icon popup_link'));
echo html::anchor(($account->comments_thread_id ? (url_lang::base().'comments/add/'.$account->comments_thread_id) : (url_lang::base().'comments_threads/add/account/'.$account->id)), html::image(array('src' => url::base().'media/images/icons/comment_add.png', 'width' => 16, 'height' => 16)), array('title' => __('Add comment to financial state of member'), 'class' => 'action-icon popup_link'));
?>
</td>
</tr>

Také k dispozici: Unified diff