icron/yii2-confirm-widget

There is no license information available for the latest version (v0.1) of this package.

Yii2 Confirm Widget (e.g. SMS)

v0.1 2015-08-19 16:50 UTC

This package is auto-updated.

Last update: 2024-10-23 02:20:29 UTC


README

Build Status Code Coverage Scrutinizer Code Quality Latest Version Software License Total Downloads

yii2-confirm-widget

Yii2 Confirm Widget (e.g. SMS) Example For example,

'components' => [
        'confirm' => [
            'class' => 'icron\confirm\Confirm',
            'provider' => 'app\components\providers\ProstorSMS',
        ],
 ],
\icron\confirm\ConfirmWidget::widget([
            'model' => (new \app\models\TestModel()),
            'attribute' => 'phone',
            'clientOptions' => [
                'url' => \yii\helpers\Url::toRoute('site/confirm'),
                'btnSend' => '.btn-send',
                'btnConfirm' => '.btn-confirm',
                'inputCode' => '.input-code'
            ],
            'clientEvents' => [
                'send.ic.modal' => 'function(e){
                    console.log(e.confirmData);
                }',
                'confirm.ic.modal' => 'function(e){
                    var data = e.confirmData || {};
                    console.log(e.confirmData);
                    if (data["status"] == "success") {
                        document.location.href = "' . \yii\helpers\Url::toRoute('site/private') . '";
                    }

                }',
            ],
        ]); 
    public function actionPrivate()
    {
        /** @var Confirm $confirm */
        $confirm = Yii::$app->confirm;
        return $this->render('private', ['items' => $confirm->getConfirmedDestinations()]);
    }