1 | <?php |
||
2 | |||
3 | /** |
||
4 | * contact. |
||
5 | * |
||
6 | * View web application basic |
||
7 | **/ |
||
8 | |||
9 | use yii\bootstrap4\ActiveForm; |
||
10 | use yii\bootstrap4\Html; |
||
11 | use yii\captcha\Captcha; |
||
12 | |||
13 | 8 | $this->title = $this->title = \Yii::t('app.basic', 'Contact'); |
|
14 | |||
15 | ?> |
||
16 | |||
17 | <?= Html::beginTag('div', ['class' => 'site-contact']) ?> |
||
18 | |||
19 | 8 | <?= Html::tag( |
|
20 | 8 | 'h1', |
|
21 | 8 | '<b>'.Html::encode($this->title).'</b>', |
|
22 | 8 | ['class' => 'text-center c-grey-900 mb-40 display-4'] |
|
23 | ) ?> |
||
24 | |||
25 | <?php if ($this->context->module->session->hasFlash('contactFormSubmitted')) : ?> |
||
26 | |||
27 | <?= Html::tag('hr', '', ['class' => 'mb-2']) ?> |
||
28 | |||
29 | <br/> |
||
30 | |||
31 | <?= Html::beginTag('p') ?> |
||
32 | 2 | <?= \Yii::t('app.basic', 'Note that if you turn on the Yii debugger, you should be able '. |
|
33 | 2 | 'to view the mail message on the mail panel of the debugger.').'</br></br>' |
|
34 | ?> |
||
35 | <?php if ($this->context->module->mailer->useFileTransport) : ?> |
||
36 | 2 | <?= \Yii::t('app.basic', 'Because the application is in development mode, the email is not sent but '. |
|
37 | 'saved as a file under:').'</br>' ?> |
||
38 | <?= '<code>'.\Yii::getAlias($this->context->module->mailer->fileTransportPath).'</code>'.'</br></br>' ?> |
||
39 | 2 | <?= \Yii::t( |
|
40 | 2 | 'app.basic', |
|
41 | 'Please configure the <code>useFileTransport</code> property of the <code>mail</code> '. |
||
42 | 2 | 'application component to be false to enable email sending.' |
|
43 | ) ?> |
||
44 | <?php endif ?> |
||
45 | <?= Html::endTag('p') ?> |
||
46 | |||
47 | 2 | <?= $this->context->module->session->setFlash( |
|
48 | 2 | 'success', |
|
49 | 2 | \Yii::t( |
|
50 | 2 | 'app.basic', |
|
51 | 2 | 'Thank you for contacting us. We will respond to you as soon as possible.' |
|
52 | ) |
||
53 | ) ?> |
||
54 | |||
55 | <?php else : ?> |
||
56 | <?= Html::beginTag('p', ['class' => 'text-center mb-4']) ?> |
||
57 | 8 | <?= \Yii::t('app.basic', 'If you have business inquiries or other questions,<br/> please fill out the '. |
|
58 | 8 | 'following form to contact us.<br/> <b>Thank you</b>.') |
|
59 | ?> |
||
60 | <?= Html::endTag('p') ?> |
||
61 | |||
62 | <?php $form = ActiveForm::begin([ |
||
63 | 8 | 'id' => 'contact-form', |
|
64 | 'layout' => 'default', |
||
65 | 'fieldConfig' => [ |
||
66 | 'template' => '{input}{label}{hint}{error}', |
||
67 | 'horizontalCssClasses' => [ |
||
68 | 'label' => '', |
||
69 | 'offset' => '', |
||
70 | 'wrapper' => '', |
||
71 | 'error' => 'text-center', |
||
72 | 'hint' => '', |
||
73 | 'field' => 'form-label-group', |
||
74 | ], |
||
75 | 'options' => ['class' => 'form-label-group'], |
||
76 | ], |
||
77 | 'options' => ['class' => 'form-contact'], |
||
78 | 'validateOnType' => false, |
||
79 | 'validateOnChange' => false, |
||
80 | ]) ?> |
||
81 | |||
82 | 8 | <?= $form->field($model, 'name') |
|
83 | 8 | ->textInput([ |
|
84 | 8 | 'autofocus' => true, |
|
85 | 8 | 'oninput' => 'this.setCustomValidity("")', |
|
86 | 8 | 'oninvalid' => 'this.setCustomValidity("'.\Yii::t('app.basic', 'Enter Username Here').'")', |
|
87 | 8 | 'placeholder' => \Yii::t('app.basic', 'Username'), |
|
88 | 8 | 'required' => (YII_ENV === 'test') ? false : true, |
|
0 ignored issues
–
show
introduced
by
![]() |
|||
89 | 8 | 'tabindex' => '1', |
|
90 | ]) |
||
91 | 8 | ->label(\Yii::t('app.basic', 'Username')) |
|
92 | ?> |
||
93 | |||
94 | 8 | <?= $form->field($model, 'email') |
|
95 | 8 | ->textInput([ |
|
96 | 8 | 'oninput' => 'this.setCustomValidity("")', |
|
97 | 8 | 'oninvalid' => 'this.setCustomValidity("'.\Yii::t('app.basic', 'Enter Email Here').'")', |
|
98 | 8 | 'placeholder' => \Yii::t('app.basic', 'Email'), |
|
99 | 8 | 'required' => (YII_ENV === 'test') ? false : true, |
|
0 ignored issues
–
show
|
|||
100 | 8 | 'tabindex' => '2', |
|
101 | ]) |
||
102 | 8 | ->label(\Yii::t('app.basic', 'Email')) |
|
103 | ?> |
||
104 | |||
105 | 8 | <?= $form->field($model, 'subject') |
|
106 | 8 | ->textInput([ |
|
107 | 8 | 'oninput' => 'this.setCustomValidity("")', |
|
108 | 8 | 'oninvalid' => 'this.setCustomValidity("'.\Yii::t('app.basic', 'Enter Subject Here').'")', |
|
109 | 8 | 'placeholder' => \Yii::t('app.basic', 'Subject'), |
|
110 | 8 | 'required' => (YII_ENV === 'test') ? false : true, |
|
0 ignored issues
–
show
|
|||
111 | 8 | 'tabindex' => '3', |
|
112 | ]) |
||
113 | 8 | ->label(\Yii::t('app.basic', 'Subject')) |
|
114 | ?> |
||
115 | |||
116 | 8 | <?= $form->field($model, 'body') |
|
117 | 8 | ->textarea([ |
|
118 | 8 | 'oninput' => 'this.setCustomValidity("")', |
|
119 | 8 | 'oninvalid' => 'this.setCustomValidity("'.\Yii::t('app.basic', 'Enter Body Here').'")', |
|
120 | 8 | 'placeholder' => \Yii::t('app.basic', 'Body'), |
|
121 | 8 | 'required' => (YII_ENV === 'test') ? false : true, |
|
0 ignored issues
–
show
|
|||
122 | 8 | 'rows' => 6, |
|
123 | 8 | 'tabindex' => '4', |
|
124 | ]) |
||
125 | 8 | ->label(\Yii::t('app.basic', 'Body')) |
|
126 | ?> |
||
127 | |||
128 | 8 | <?= $form->field($model, 'verifyCode', [ |
|
129 | 8 | 'labelOptions' => ['id' => 'verifyCode'], |
|
130 | 8 | ])->widget( |
|
131 | 8 | Captcha::class, |
|
132 | [ |
||
133 | 8 | 'template' => '{input}<div class="text-center">'.'<b>'. |
|
134 | 8 | \Yii::t('app.basic', 'Captcha Code').':'.'</b>'.'{image}</div>', |
|
135 | 'options' => [ |
||
136 | 8 | 'class' => 'form-control', |
|
137 | 8 | 'oninput' => 'this.setCustomValidity("")', |
|
138 | 'oninvalid' => 'this.setCustomValidity("'. |
||
139 | 8 | \Yii::t('app.basic', 'Enter Captcha Code Here').'")', |
|
140 | 8 | 'placeholder' => \Yii::t('app.basic', 'Captcha Code'), |
|
141 | 8 | 'required' => (YII_ENV === 'test') ? false : true, |
|
0 ignored issues
–
show
|
|||
142 | 8 | 'style' => 'margin-bottom:10px', |
|
143 | 8 | 'tabindex' => '5', |
|
144 | ], |
||
145 | ] |
||
146 | ) |
||
147 | 8 | ->label(\Yii::t('app.basic', 'Captcha Code')) |
|
148 | ?> |
||
149 | |||
150 | <?= Html::beginTag('div', ['class' => 'form-group']) ?> |
||
151 | 8 | <?= Html::submitButton(\Yii::t('app.basic', 'Contact us'), [ |
|
152 | 8 | 'class' => 'btn btn-lg btn-primary btn-block', 'name' => 'contact-button', 'tabindex' => '6', |
|
153 | ]) ?> |
||
154 | <?= Html::endTag('div') ?> |
||
155 | |||
156 | <?php ActiveForm::end() ?> |
||
157 | |||
158 | <?php endif ?> |
||
159 | |||
160 | <?php echo Html::endTag('div'); |
||
161 |