<commit_before><?php

/*
 * Finance Plugin for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-finance
 * @package   hipanel-module-finance
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2015, HiQDev (https://hiqdev.com/)
 */

namespace hipanel\modules\finance\grid;

use hipanel\helpers\FontIcon;
use Yii;
use yii\helpers\Html;

class PurseGridView extends \hipanel\grid\BoxedGridView
{
    public static function defaultColumns()
    {
        return [
            'balance' => [
                'class' => 'hipanel\modules\finance\grid\BalanceColumn',
            ],
            'credit' => CreditColumn::resolveConfig(),
            'invoices' => [
                'format' => 'raw',
                'value'  => function ($model) {
                    $curr = date('Y-m-1');
                    $prev = date('Y-m-1', strtotime($curr) - 1000);
                    return Html::a(FontIcon::i('fa-history fa-2x') . ' ' .Yii::t('app', 'Archive'), ['@purse/invoice-archive', 'id' => $model->id], ['class' => 'pull-right']).
                        self::pdfLink($model, $curr) . ' &nbsp; ' . self::pdfLink($model, $prev);
                }
            ],
        ];
    }

    public static function pdfLink($model, $month = 'now')
    {
        $date = strtotime($month);
        return Html::a(FontIcon::i('fa-file-pdf-o fa-2x') . date(' M Y', $date), ['@purse/pdf-invoice', 'id' => $model->id, 'month' => date('Y-m-01', $date)], ['target' => '_blank', 'class' => 'text-info']);
    }
}<commit_msg>minor<commit_after><?php

/*
 * Finance Plugin for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-finance
 * @package   hipanel-module-finance
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2015, HiQDev (https://hiqdev.com/)
 */

namespace hipanel\modules\finance\grid;

use hipanel\helpers\FontIcon;
use Yii;
use yii\helpers\Html;

class PurseGridView extends \hipanel\grid\BoxedGridView
{
    public static function defaultColumns()
    {
        return [
            'balance' => [
                'class' => 'hipanel\modules\finance\grid\BalanceColumn',
            ],
            'credit' => CreditColumn::resolveConfig(),
            'invoices' => [
                'format' => 'raw',
                'value'  => function ($model) {
                    $curr = date('Y-m-1');
                    $prev = date('Y-m-1', strtotime($curr) - 1000);
                    return Html::a(FontIcon::i('fa-history fa-2x') . ' ' .Yii::t('app', 'Archive'), ['@purse/invoice-archive', 'id' => $model->id], ['class' => 'pull-right text-nowrap']).
                        self::pdfLink($model, $curr) . ' &nbsp; ' . self::pdfLink($model, $prev);
                }
            ],
        ];
    }

    public static function pdfLink($model, $month = 'now')
    {
        $date = strtotime($month);
        return Html::a(FontIcon::i('fa-file-pdf-o fa-2x') . date(' M Y', $date), ['@purse/pdf-invoice', 'id' => $model->id, 'month' => date('Y-m-01', $date)], ['target' => '_blank', 'class' => 'text-info text-nowrap']);
    }
}
{'fraction_non_alphanumeric': 0.19245773732119636, 'fraction_numerical': 0.01235370611183355, 'mean_word_length': 2.175438596491228, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '744003', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1015, 'n_words': 184}