/**
  * Renders the widget.
  */
 public function run()
 {
     //echo $this->model->state;
     //for new record creation
     if ($this->model->isNewRecord || $this->model->state == AppActiveRecord::STATUS_DRAFT) {
         if (\yii::$app->user->can('saveasdraft')) {
             echo '  ';
             AjaxSubmitButton::begin(['label' => 'Save as Draft', 'options' => ['id' => 'saveasdraft-btn', 'class' => 'btn btn-lg btn-warning', 'type' => 'button'], 'ajaxOptions' => ['type' => 'POST', 'url' => Url::toRoute(array_merge(['saveasdraft'], $this->params)), 'success' => new \yii\web\JsExpression('function(data){                        
                         if(data.status){
                             location.href = "' . Url::toRoute(array_merge(['index'])) . '";
                         }
                      }')]]);
             AjaxSubmitButton::end();
             $this->view->registerJs("\$( '#saveasdraft-btn' ).click(function() {\n                \$(this).addClass('disabled');\n            });");
         }
     }
     if (\yii::$app->user->can('create') || \yii::$app->user->can('update')) {
         echo '  ';
         echo Html::submitButton('Save', ['class' => 'btn btn-lg btn-info aftervalidate']);
     }
     if (!$this->model->isNewRecord && $this->model->state != AppActiveRecord::STATUS_DRAFT && ($this->model->state != AppActiveRecord::STATUS_PUBLISH || $this->model->state != AppActiveRecord::STATUS_PUBLISHREADY)) {
         if ($this->model->state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('publish')) {
             echo '  ';
             echo Html::submitButton('Publish', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['publish'], $this->params))]);
         } elseif ($this->model->state != AppActiveRecord::STATUS_PUBLISHREADY && $this->model->state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('sendtopublish')) {
             echo '  ';
             echo Html::submitButton('Send to Publisher', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['sendtopublish'], $this->params))]);
         }
     }
     /*
             echo '  ';
             AjaxSubmitButton::begin([
                 'label' => 'Validate',
                 'options' => [
                     'class' => 'btn btn-lg btn-primary',
                     'type'  => 'submit',
                 ],
                 'ajaxOptions' => [
                     'type'  =>'POST',
                     'url'   => Url::toRoute(array_merge(['validate'],$this->params)),
                     'success' => new \yii\web\JsExpression('function(data){
                         $("#errorwarning").html(data.html);
                         if(data.status){
                             $(".aftervalidate").removeClass("disabled");
                         }
                      }'),
                 ],
             ]);
             AjaxSubmitButton::end();
             //*/
     echo '  ';
     echo Html::resetButton('Reset', ['class' => 'btn btn-lg btn-default']);
     echo '  ';
     echo Html::resetButton('Back', ['class' => 'btn btn-lg btn-default', 'onclick' => 'history.go(-1);return true;']);
     echo "\n" . Html::endTag('div');
     $this->view->registerJs("\$('.changeaction').click(function() {\n                    if(typeof \$(this).attr('data-url') != 'undefined' && \$(this).attr('data-url') != ''){\n                        \$(this).parents('form').attr('action',\$(this).attr('data-url')).submit();\n                    }\n                });");
 }
Esempio n. 2
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     //echo $this->model->state;
     //for new record creation
     $modal = [];
     $_state = $this->model->state;
     if ($this->model->isNewRecord || $_state == AppActiveRecord::STATUS_DRAFT) {
         if (\yii::$app->user->can('saveasdraft')) {
             echo '  ';
             AjaxSubmitButton::begin(['label' => 'Save as Draft', 'options' => ['id' => 'saveasdraft-btn', 'class' => 'btn btn-lg btn-warning', 'type' => 'button'], 'ajaxOptions' => ['type' => 'POST', 'url' => Url::toRoute(array_merge(['saveasdraft'], $this->params)), 'success' => new \yii\web\JsExpression('function(data){                        
                         if(data.status){
                             location.href = "' . Url::toRoute(array_merge(['index'])) . '";
                         }
                      }')]]);
             AjaxSubmitButton::end();
             $this->view->registerJs("\$( '#saveasdraft-btn' ).click(function() {\n                \$(this).addClass('disabled');\n            });");
         }
     }
     if (\yii::$app->user->can('create') || \yii::$app->user->can('update')) {
         echo '  ';
         echo Html::submitButton('Save', ['class' => 'btn btn-lg btn-info aftervalidate']);
     }
     if (!$this->model->isNewRecord && $_state != AppActiveRecord::STATUS_DRAFT && $_state != AppActiveRecord::STATUS_SOURCED && ($_state != AppActiveRecord::STATUS_PUBLISH || $_state != AppActiveRecord::STATUS_PUBLISHREADY)) {
         //not in draft, not new, not publish, not ready to ready, can be draft update or sourced
         if ($_state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('publish')) {
             //not in draft, not new, not publish, not ready to ready
             echo '  ';
             echo Html::submitButton('Publish', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['publish'], $this->params))]);
         } elseif ($_state != AppActiveRecord::STATUS_PUBLISHREADY && $_state != AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('sendtopublish')) {
             echo '  ';
             echo Html::submitButton('Send to Publisher', ['class' => 'btn btn-lg changeaction btn-success aftervalidate', 'data-url' => Url::toRoute(array_merge(['sendtopublish'], $this->params))]);
         }
     }
     if ($this->deletebtn && \yii::$app->user->can('delete') && !$this->model->isNewRecord) {
         echo '  ';
         $deletemodal = 'modal-trash';
         $modal[] = ['id' => $deletemodal, 'header' => '<h4>Delete ' . strtolower($this->model->ClassSortNeme()) . ': ' . $this->model->name . '</h4>'];
         echo Html::button($this->deletebtntxt, ['class' => 'btn btn-danger btn-lg', 'title' => Yii::t('yii', 'Unpublish'), 'data-toggle' => 'modal', 'data-target' => '#' . $deletemodal, 'data-remote' => Url::toRoute(['delete', 'id' => $this->model->id])]);
     }
     if ($this->unpublishbtn && $this->model->state == AppActiveRecord::STATUS_PUBLISH && \yii::$app->user->can('unpublish')) {
         echo '&nbsp;&nbsp;';
         $uppublishedmodal = 'modal-unpub';
         $modal[] = ['id' => $uppublishedmodal, 'header' => '<h4>Unpublish ' . strtolower($this->model->ClassSortNeme()) . ': ' . $this->model->name . '</h4>'];
         echo Html::button($this->unpublishbtntxt, ['class' => 'btn btn-warning btn-lg', 'title' => Yii::t('yii', $this->unpublishbtntxt), 'data-toggle' => 'modal', 'data-target' => '#' . $uppublishedmodal, 'data-remote' => Url::toRoute(['unpublish', 'id' => $this->model->id])]);
     }
     echo '&nbsp;&nbsp;';
     echo Html::resetButton('Reset', ['class' => 'btn btn-lg btn-default']);
     echo '&nbsp;&nbsp;';
     echo Html::resetButton('Back', ['class' => 'btn btn-lg btn-default', 'onclick' => 'history.go(-1);return true;']);
     echo "\n" . Html::endTag('div');
     foreach ($modal as $bs_modal) {
         echo Modal::widget($bs_modal);
     }
     $this->view->registerJs("\n                    var _frm = \$('.changeaction').first().closest('form');\n                    var _frmdata = null,alreadySubmitted = false;\n                    if(_frm != null && _frm !=undefined){\n                        _frmdata = _frm.serialize();\n                    }\n        ");
     $this->view->registerJs("\$('.changeaction').click(function(e) {\n                    e.preventDefault();\n                    if(typeof \$(this).attr('data-url') != 'undefined' && \$(this).attr('data-url') != ''){\n                        btnType = \$(this).text();\n                        frm = \$(this).parents('form');\n                        if(btnType == 'Publish'){\n                            if(_frmdata != null && _frmdata != frm.serialize()){\n                                alert('Please save changes before going to publish it');\n                                return false;\n                            }\n                        }\n                        if(alreadySubmitted === false){\n                            \$(this).parents('form').attr('action',\$(this).attr('data-url')).submit();\n                            aalreadySubmitted = true;\n                        }\n                    }\n                });");
 }
Esempio n. 3
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::beginForm('', 'post', ['class' => 'uk-width-medium-1-1 uk-form uk-form-horizontal']);
?>
        <?php 
echo Select2::widget(['name' => 'country_code', 'data' => Organisations::dropdown(), 'options' => ['id' => 'country_select', 'multiple' => false, 'placeholder' => 'Choose...', 'class' => 'uk-width-medium-7-10']]);
?>
        <?php 
AjaxSubmitButton::begin(['label' => 'Refresh', 'ajaxOptions' => ['type' => 'POST', 'url' => 'index.php?r=organisations/refreshdata1', 'success' => new \yii\web\JsExpression('function(html){
                  $("#output").html(html);
                  }')], 'options' => ['class' => 'btn btn-primary', 'type' => 'submit']]);
AjaxSubmitButton::end();
?>
        <?php 
echo Html::endForm();
?>
    </p>
    <div id="output"></div>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'uid', 'label', 'abbreviation', 'category', 'website', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
    
                <br>     
        <?php 
// Select Date Range:
// 1. Get Data From Preferences
$currentDates = Preferences::getSelectedDates();
echo '<label class="control-label">Επιλογή Ημερομηνιών</label>';
echo DatePicker::widget(['type' => DatePicker::TYPE_RANGE, 'name' => 'select_start_date', 'value' => $currentDates[0], 'name2' => 'select_end_date', 'value2' => $currentDates[1], 'separator' => '<i class="glyphicon glyphicon-resize-horizontal"></i>', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
echo '<br>';
echo '<label class="control-label">ΑΦΜ...</label><br>';
echo Html::textInput("setAFM", "", ['id' => 'setAFM']);
?>
                <br><br>
            <?php 
AjaxSubmitButton::begin(['label' => 'Αναζήτηση', 'ajaxOptions' => ['type' => 'POST', 'url' => 'site/updatesettings', 'success' => new \yii\web\JsExpression('function(html){
                        $("#output").html(html);
                        }')], 'options' => ['class' => 'customclass', 'type' => 'submit']]);
AjaxSubmitButton::end();
echo Html::endForm();
?>
                
        <p>

        </p>              
            <p>
                <?php 
$updateDate = Preferences::getRefreshDate();
echo '<br><br><label class="control-label">Τελευταία Ενημέρωση: </label>';
echo '<label class="control-label">' . $updateDate[0] . '</label>';
?>
            </p>
AjaxSubmitButton::begin(['label' => 'Ανανέωση', 'ajaxOptions' => ['type' => 'POST', 'url' => '?r=site/updatesettings', 'success' => new \yii\web\JsExpression('function(html){
                        $("#output").html(html);
                        }')], 'options' => ['class' => 'btn btn-success', 'type' => 'submit']]);
AjaxSubmitButton::end();
echo Html::endForm();
?>
        <p>
            <div id="output"></div>
        </p>              
        </div>
        <div class="col-lg-5">
            <?php 
AjaxSubmitButton::begin(['label' => 'Ενημέρωση Από τη Διαύγεια', 'ajaxOptions' => ['type' => 'POST', 'url' => '?r=site/refreshdataajax', 'beforeSend' => new \yii\web\JsExpression('function (xhr) {
                         $(".wrap").addClass("loading");
                    }'), 'complete' => new \yii\web\JsExpression('function (xhr) {
                         $(".wrap").removeClass("loading");
                    }'), 'success' => new \yii\web\JsExpression('function(html){
                        $("#output_refresh").html(html);
                        }')], 'options' => ['class' => 'btn btn-success', 'type' => 'submit']]);
AjaxSubmitButton::end();
?>
            <div id="output_refresh"></div>
                <!-- UPDATE BTN + 2-3 STATISTICS-->
                <?php 
$updateDate = Preferences::getRefreshDate();
echo '<br><br><label class="control-label">Τελευταία Ενημέρωση: </label>';
echo '<label class="control-label">' . $updateDate[0] . '</label>';
?>
 
        </div>
    </div>
Esempio n. 6
0
                    <div class="row">
                        <div class="col-md-12">
<!--                                <img src="--><?php 
//echo Yii::$app->getUrlManager()->getBaseUrl()
?>
<!--/theme/images/search-icon.png" onclick="$('#GoSumbmit').click()" class="center-block margin-top20" >-->
                                <input type="image" name="submit" src="<?php 
echo Yii::$app->getUrlManager()->getBaseUrl();
?>
/theme/images/search-icon.png"
                                       border="0" class="center-block margin-top20" />
                            <?php 
$label = '';
AjaxSubmitButton::begin(['label' => $label, 'id' => 'GoSumbmit', 'ajaxOptions' => ['type' => 'POST', 'url' => '/stores/index', 'success' => new \yii\web\JsExpression('function(html){
                                   $("#resultData").html(html);

                                        }')], 'options' => ['type' => 'submit', 'style' => 'display:none']]);
AjaxSubmitButton::end();
?>


                        </div>
                    </div>

                    <?php 
ActiveForm::end();
?>

                </div>
            </div>
        </div>
Esempio n. 7
0
?>

                                    <?php 
//echo Html::beginForm('', 'post', ['class'=>'uk-width-medium-1-1 uk-form uk-form-horizontal']);
?>

                                    <?php 
//= Html::submitButton(Yii::t('easyii','Add to Cart').' <i class="fa fa-cart-arrow-down fa-lg"></i>' , ['class' => 'btn dry-btn'])
?>
                                    <?php 
$label = Yii::t('easyii', 'Add to Cart');
//. '<i class="fa fa-cart-arrow-down fa-lg"></i>';
AjaxSubmitButton::begin(['label' => $label, 'ajaxOptions' => ['type' => 'POST', 'url' => '/shopcart/add', 'success' => new \yii\web\JsExpression('function(html){
                $("#emptylink_' . $item->id . '").attr("href", "/shopcart");
                $("#empty_' . $item->id . '").empty();
                 $("#output_' . $item->id . '").html(html);
                 $("#chanStat").attr("href", "/shopcart");


            }')], 'options' => ['class' => 'btn dry-btn', 'type' => 'submit']]);
AjaxSubmitButton::end();
?>







                                </div>
                            </div></div>
                        <div class="clear"><br/></div>
    
                <br>     
        <?php 
// Select Date Range:
// 1. Get Data From Preferences
$currentDates = Preferences::getSelectedDates();
echo '<label class="control-label">Επιλογή Ημερομηνιών</label>';
echo DatePicker::widget(['type' => DatePicker::TYPE_RANGE, 'name' => 'select_start_date', 'value' => $currentDates[0], 'name2' => 'select_end_date', 'value2' => $currentDates[1], 'separator' => '<i class="glyphicon glyphicon-resize-horizontal"></i>', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
echo '<br>';
echo '<label class="control-label">ΑΦΜ...</label><br>';
echo Html::textInput("setAFM", "", ['id' => 'setAFM']);
?>
                <br><br>
            <?php 
AjaxSubmitButton::begin(['label' => 'Αναζήτηση', 'ajaxOptions' => ['type' => 'POST', 'url' => '?r=site/submitquery', 'success' => new \yii\web\JsExpression('function(response){
                        $("#output").html(response.search);
                        }')], 'options' => ['class' => 'customclass', 'type' => 'submit']]);
AjaxSubmitButton::end();
echo Html::endForm();
?>
                
        <p>
            <div id="output"></div>
            <a class='my-link'>XYZ</a>
        </p>              
            <p>
                <?php 
$updateDate = Preferences::getRefreshDate();
echo '<br><br><label class="control-label">Τελευταία Ενημέρωση: </label>';
echo '<label class="control-label">' . $updateDate[0] . '</label>';
?>
Esempio n. 9
0
                                  </div>
                                        
                                    <div id="slider-range-max4"></div>
                                </div>
                            </div>
                        </div>
                        <?php 
//= Html::submitButton('Submit', ['class' => 'btn btn-primary'])
?>
                        <input type="hidden" name="slug" value="products">
                        <?php 
$label = '';
AjaxSubmitButton::begin(['label' => $label, 'id' => 'GoSumbmitProducts', 'ajaxOptions' => ['type' => 'POST', 'url' => '/products/index', 'success' => new \yii\web\JsExpression('function(html){
                                   $("#resultData").html(html);
                                    $("html, body").animate({
                                     scrollTop: $("#resultData").offset().top
                                         }, 2000);

                                        }')], 'options' => ['type' => 'submit', 'style' => 'display:none']]);
AjaxSubmitButton::end();
?>




                        <?php 
ActiveForm::end();
?>

                    </div>
                </div>