echo Module::t('', "This {startLink}order{endLink} has already been paid!", ['dot' => true, 'startLink' => Html::beginTag('a', ['href' => Url::to(['default/invoice', 'alias' => $model->alias])]), 'endLink' => Html::endTag('a')]); ?> <?php Alert::end(); ?> <?php } else { ?> <?php Alert::begin(['closeButton' => false, 'options' => ['class' => 'alert-info']]); ?> <?php echo Module::t('', "Wait please!"); ?> <?php Alert::end(); ?> <?php $form = ActiveForm::begin(['id' => 'returnform', 'action' => Yii::$app->oplata->url]); ?> <?php foreach ($request as $name => $value) { echo Html::hiddenInput($name, $value); } ?> <?php ActiveForm::end();
echo $model->email; ?> </td> </tr> <tr> <td style="width: 50%;"><?php echo Adm::t('oplata/mail', "Price:"); ?> </td> <td> <span class="text-color3"><?php echo Yii::$app->oplata->price($model->price + $model->shipping); ?> </span> <span class="text-color"><sup><?php echo Module::getInstance()->manager->createOplataTransactionQuery('currency_list', $model->currency); ?> </sup></span> </td> </tr> <tr> <td style="width: 50%;"><?php echo Adm::t('oplata/mail', "Created:"); ?> </td> <td><?php echo Yii::$app->formatter->asDatetime($model->created_at); ?> </td> </tr> <tr>
<?php use frontend\assets\AppAsset; use pavlinter\admoplata\models\OplataTransaction; use pavlinter\admoplata\Module; use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $model OplataTransaction */ $admoplata = Module::getInstance(); $appAsset = AppAsset::register($this); $admoplata->layout = $admoplata->invoiceLayout; $this->title = Yii::t('adm/admoplata', "Invoice: #{id}, {title}", ['id' => $model->id, 'title' => $model->title, 'dot' => false]); ?> <div class="admoplata-invoice admoplata-container"> <div class="panel panel-default"> <div class="panel-body"> <div class="row"> <div class="col-sm-6"> <?php echo Yii::t('adm/admoplata', '<h5 class="lg-title mb10">From</h5><address>Web Services, Inc.</address>', ['dot' => true]); ?> </div><!-- col-sm-6 --> <div class="col-sm-6 text-right"> <div> <?php if ($model->user_id) { ?> <?php echo Yii::t('adm/admoplata', '<h4 class="text-primary">Invoice No. {invoice-number}</h4>To: {email}<br/>Invoice Date: {date}<br/>Payment day: {date_end}<br/>Status: {status}<br/>{description}', ['invoice-number' => $model->id, 'email' => $model->email, 'date' => Yii::$app->formatter->asDate($model->created_at), 'time' => Yii::$app->formatter->asTime($model->created_at), 'status' => $model::status_list($model->response_status), 'description' => nl2br($model->description), 'date_end' => Yii::$app->formatter->asDate($model->date_end), 'dot' => false]);
/** * For cron */ public function actionCron() { $module = Module::getInstance(); if (!$module->remindDays) { return 'Remind Disabled'; } $query = $module->manager->createOplataTransactionQuery(); /* @var \yii\db\Query $query */ $query->where(['response_status' => OplataTransaction::STATUS_NOT_PAID, 'remind_note' => 0])->andWhere("NOW() > DATE_SUB(date_end, INTERVAL :day DAY) AND NOW() < date_end", ['day' => $module->remindDays]); foreach ($query->batch(10) as $models) { foreach ($models as $model) { Yii::$app->getI18n()->changeLanguage($model->language_id); $username = ''; $user = null; if ($model->user_id) { $user = $model->user; if ($user) { $username = $user->username; } } Yii::$app->mailer->htmlLayout = false; $res = Yii::$app->mailer->compose(['html' => $module->remindTemplate], ['model' => $model, 'username' => $username])->setTo($model->email)->setFrom($module->sendFrom)->setSubject(Adm::t("oplata/remind", "Remind Payment Day", ['dot' => false]))->send(); if ($res) { $model->remind_note = 1; $model->save(false); } sleep(2); } } return 'Success!'; }
<div class="col-sm-4"> <?php echo $form->field($model, 'currency')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInstance()->manager->createOplataTransactionQuery('currency_list')]); ?> </div> </div> <div class="row"> <div class="col-sm-4"> <?php echo $form->field($model, 'payment_id')->textInput(['readonly' => true]); ?> </div> <div class="col-sm-4"> <?php echo $form->field($model, 'response_status')->widget(\kartik\widgets\Select2::classname(), ['data' => Module::getInstance()->manager->createOplataTransactionQuery('status_list')]); ?> </div> <div class="col-sm-4"> <?php echo $form->field($model, 'date_end')->widget(\kartik\date\DatePicker::className(), ['pluginOptions' => ['allowClear' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd']]); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($model, 'language_id')->widget(\kartik\widgets\Select2::classname(), ['data' => \yii\helpers\ArrayHelper::map($languages, 'id', 'name')]); ?> </div>
/** * @return \yii\db\ActiveQuery */ public function getTransaction() { return $this->hasOne(Module::getInstance()->manager->createOplataTransaction('className'), ['id' => 'oplata_transaction_id']); }
<?php use pavlinter\admoplata\Module; use yii\bootstrap\Alert; use yii\helpers\Html; use yii\helpers\Url; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model \pavlinter\admpages\models\Page */ /* @var $request array */ /* @var $isPaid boolean */ $admoplata = Module::getInstance(); $admoplata->layout = $admoplata->invoiceLayout; ?> <div class="admoplata-response admoplata-container"> <?php Alert::begin(['closeButton' => false, 'options' => ['class' => 'alert-success']]); ?> <?php echo Module::t('', "Thank you for shopping! Your {startLink}order{endLink}.", ['dot' => true, 'startLink' => Html::beginTag('a', ['href' => Url::to(['default/invoice', 'alias' => $model->alias])]), 'endLink' => Html::endTag('a')]); ?> <?php Alert::end(); ?> </div>
/** * @param bool $method * @return array|null */ public static function method_list($method = false) { $module = Module::getInstance(); if ($module) { $module = Yii::$app->getModule('admoplata'); } $list = $module->methodList; if ($method !== false) { if (isset($list[$method])) { return $list[$method]; } return null; } return $list; }
/** * Client side * @return string * @throws NotFoundHttpException */ public function actionResponse() { list($order_id, ) = explode(Oplata::ORDER_SEPARATOR, Yii::$app->request->post('order_id')); $model = Module::getInstance()->manager->createOplataTransactionQuery()->where(['id' => $order_id])->one(); if (!$model) { throw new NotFoundHttpException('The requested page does not exist.'); } return $this->render('response', ['model' => $model]); }
/** * @param $int * @param $currency * @return string */ public function price($int, $currency = null) { if ($currency) { $currency = ' ' . Module::getInstance()->manager->createOplataTransactionQuery('currency_list', $currency); } else { $currency = null; } return Yii::$app->formatter->asDecimal($int, 2) . $currency; }
}, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'minimumResultsForSearch' => -1]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['attribute' => 'response_status', 'vAlign' => 'middle', 'hAlign' => 'center', 'filterType' => GridView::FILTER_SELECT2, 'filter' => Module::getInstance()->manager->createOplataTransactionQuery('status_list'), 'value' => function ($model) { if (!empty($model->response_status)) { $text = Module::getInstance()->manager->createOplataTransactionQuery('status_list', $model->response_status); $class = ''; if ($model->response_status === $model::STATUS_SUCCESS) { $class = 'text-success'; } else { if ($model->response_status === $model::STATUS_FAILURE) { $class = 'text-danger'; } } return Html::tag('span', $text, ['class' => $class]); } }, 'filterWidgetOptions' => ['pluginOptions' => ['escapeMarkup' => new JsExpression('function (m) { return m; }'), 'allowClear' => true, 'minimumResultsForSearch' => -1]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['attribute' => 'method', 'vAlign' => 'middle', 'hAlign' => 'center', 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::merge(['null' => Yii::t('yii', '(not set)')], Module::getInstance()->manager->createOplataTransactionQuery('method_list')), 'value' => function ($model) { if (!empty($model->response_status)) { $text = Module::getInstance()->manager->createOplataTransactionQuery('method_list', $model->method); return $text; } }, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'minimumResultsForSearch' => -1]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['attribute' => 'created_at', 'width' => '160px', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd']], 'vAlign' => 'middle', 'hAlign' => 'center'], ['attribute' => 'date_end', 'width' => '160px', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'todayHighlight' => true, 'format' => 'yyyy-mm-dd']], 'vAlign' => 'middle', 'hAlign' => 'center'], ['attribute' => 'sent_email', 'width' => '120px', 'vAlign' => 'middle', 'hAlign' => 'center', 'format' => 'raw', 'value' => function ($model) { $remind = ''; if ($model->remind_note) { $remind = ' ' . Html::tag('span', '', ['class' => 'fa fa-envelope-o text-success cursor-help', 'data-toggle' => 'tooltip', 'title' => Adm::t('admoplata', 'Remind note sent')]); } if ($model->sent_email || $model->response_status !== $model::STATUS_NOT_PAID) { return Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok text-success cursor-help', 'data-toggle' => 'tooltip', 'title' => Adm::t('admoplata', 'Email Sent')]) . $remind; } return \pavlinter\buttons\AjaxButton::widget(['label' => Adm::t('oplata', 'Send'), 'options' => ['class' => 'btn btn-primary'], 'ajaxOptions' => ['url' => Url::to('send-email'), 'data' => ['id' => $model->id], 'done' => 'function(data){ if(data.r){ $("#" + abId).next("span").removeClass("hide").end().remove(); } }']]) . Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok text-success hide cursor-help', 'data-toggle' => 'tooltip', 'title' => Adm::t('admoplata', 'Email Sent')]) . $remind;