-
Notifications
You must be signed in to change notification settings - Fork 7
/
details.html
272 lines (236 loc) · 13 KB
/
details.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
{strip}
{$_errors = []}
{if !empty($error_step_id) && $error_step_id === "details"}{$_errors = $errors}{/if}
<section class="wa-step-section wa-step-details-section" id="wa-step-details-section" style="{if empty($details)}display:none;{/if}">
{* BODY *}
<div class="wa-section-body">
<form>
{if !empty($details)}
{$_inline_fields = []}
{$_custom_fields = []}
{$_required_inline_fields = []}
{$_required_custom_fields = []}
{* render_field function here *}
{include file="./render_field.function.html" inline}
{* FIELDS *}
{if !empty($details.shipping_address_fields)}
{foreach $details.shipping_address_fields_order as $_field_id}
{if !empty($details.shipping_address_fields[$_field_id])}
{$_field = $details.shipping_address_fields[$_field_id]}
{else}
{continue}
{/if}
{if !empty($_field.affects_rate)}
{capture append="_required_inline_fields"}{render_field _field=$_field}{/capture}
{else}
{capture append="_inline_fields"}{render_field _field=$_field}{/capture}
{/if}
{/foreach}
{/if}
{* PLUGINS *}
{if !empty($details.plugin_custom_fields_order)}
{foreach $details.plugin_custom_fields_order as $_field_id}
{if !empty($details.plugin_custom_fields[$_field_id])}
{$_plugin = $details.plugin_custom_fields[$_field_id]}
{if !empty($_plugin.html)}
{if !empty($_plugin.wa_css_class_added)}
{capture assign="_inline_field"}
<div class="wa-field-wrapper size-small">
{if !empty($_plugin.label)}
<div class="wa-label">
{$_plugin.label|escape}
{if !empty($_plugin.affects_rate)}<span class="wa-required"></span>{/if}
</div>
{/if}
{$_plugin.html}
</div>
{/capture}
{if !empty($_plugin.affects_rate)}
{$_required_inline_fields[] = $_inline_field}
{else}
{$_inline_fields[] = $_inline_field}
{/if}
{else}
{capture assign="_custom_field"}
<div class="wa-line wa-plugin-field-wrapper">
{if !empty($_plugin.label)}
<div class="wa-label">
{$_plugin.label|escape}
{if !empty($_plugin.affects_rate)}<span class="wa-required"></span>{/if}
</div>
{/if}
{$_plugin.html}
{if !empty($_plugin.description)}
<div class="wa-description">{$_plugin.description|escape}</div>
{/if}
</div>
{/capture}
{if !empty($_plugin.affects_rate)}
{$_required_custom_fields[] = $_custom_field}
{else}
{$_custom_fields[] = $_custom_field}
{/if}
{/if}
{/if}
{else}
{continue}
{/if}
{/foreach}
{/if}
{* RENDER *}
{if !empty($_required_inline_fields) || !empty($_required_custom_fields)}
<div class="wa-details-required-fields-section">
{if !empty($_required_inline_fields)}
<div class="wa-line wa-fields-group line">{$_required_inline_fields|join:""}</div>
{/if}
{if !empty($_required_custom_fields)}
{$_required_custom_fields|join:""}
{/if}
</div>
{/if}
{* INFO *}
{if !empty($details.shipping_rate)}
{$_address = null}
{$_way = null}
{$_additional = null}
{$_storage_days = null}
{$_photos = null}
{if !empty($details.shipping_rate.custom_data)}
{$_data = $details.shipping_rate.custom_data}
{if !empty($details.shipping_rate.type) && !empty($_data[$details.shipping_rate.type])}
{$_custom_data = $_data[$details.shipping_rate.type]}
{if !empty($_custom_data.description)}
{$_address = $_custom_data.description}
{/if}
{if !empty($_custom_data.way)}
{$_way = $_custom_data.way}
{/if}
{if !empty($_custom_data.additional)}
{$_additional = $_custom_data.additional}
{/if}
{if !empty($_custom_data.storage_days)}
{$_storage_days = $_custom_data.storage_days}
{/if}
{if !empty($_custom_data.photos)}
{$_photos = $_custom_data.photos}
{/if}
{/if}
{/if}
<div class="wa-details-rates-section">
<div class="wa-table">
<div class="wa-row">
<div class="wa-cell wa-cell-name">
<div class="wa-name">[`Стоимость`]</div>
</div>
<div class="wa-cell wa-cell-value">
<span class="wa-delivery-price">{shop_currency($details.shipping_rate.rate, ['in_currency' => $details.shipping_rate.currency,'extended_format' => '%t{h}'])}</span>
</div>
</div>
<div class="wa-row">
<div class="wa-cell wa-cell-name">
<div class="wa-name">[`Срок доставки`]</div>
</div>
<div class="wa-cell wa-cell-value">
{$details.shipping_rate.est_delivery|default:"—"|escape}
</div>
</div>
{if !empty($_storage_days)}
<div class="wa-row">
<div class="wa-cell wa-cell-name">
<div class="wa-name">[`Срок хранения заказа`]</div>
</div>
<div class="wa-cell wa-cell-value">
{_w('%d day', '%d days', $_storage_days)}
</div>
</div>
{/if}
{if !empty($_address)}
<div class="wa-row">
<div class="wa-cell wa-cell-name">
<div class="wa-name">[`Адрес`]</div>
</div>
<div class="wa-cell wa-cell-value">{$_address|escape}</div>
</div>
{/if}
<div class="wa-row">
<div class="wa-cell wa-cell-name">
<div class="wa-name">[`Служба доставки`]</div>
</div>
<div class="wa-cell wa-cell-value">
{$details.shipping_rate.plugin_name|default:"—"|escape}
</div>
</div>
</div>
{if !empty($details.shipping_rate.pickup_schedule.days)}
<div class="wa-line wa-schedule-wrapper">
<div class="wa-label">[`Часы работы`]:</div>
<div class="wa-value">
{foreach $details.shipping_rate.pickup_schedule.days as $_day}
<div class="wa-day-wrapper">
<div class="wa-date">{$_day.weekday_short|escape}, {$_day.date_formatted|escape}</div>
<div class="wa-value">
{if !empty($_day.works)}
<div class="wa-time">{$_day.time_start|escape}–{$_day.time_end|escape}</div>
{else}
<div class="wa-text">[`выходной`]</div>
{/if}
</div>
</div>
{/foreach}
</div>
</div>
{/if}
{if !empty($_way)}
<div class="wa-line wa-comment-item">
<div class="wa-label">[`Как добраться`]:</div>
<div class="wa-value">{$_way|escape}</div>
</div>
{/if}
{if !empty($_additional)}
<div class="wa-line wa-additional-item">
<div class="wa-label">[`Дополнительно`]:</div>
<div class="wa-value">{$_additional|escape}</div>
</div>
{/if}
{if !empty($_photos)}
<div class="wa-line wa-photos-section">
{foreach $_photos as $_photo}
{if !empty($_photo.uri)}
<div class="wa-photo-wrapper">
<a class="wa-photo js-show-photo" href="{$_photo.uri|escape}"
style="background-image: url({$wa->shop->imgUrl($_photo.uri|escape, '100x75')});"></a>
</div>
{/if}
{/foreach}
</div>
{/if}
</div>
{/if}
{if !empty($_inline_fields) || !empty($_custom_fields)}
<div class="wa-details-fields-section">
{if !empty($_inline_fields)}
<div class="wa-line wa-fields-group line">{$_inline_fields|join:""}</div>
{/if}
{if !empty($_custom_fields)}
{$_custom_fields|join:""}
{/if}
</div>
{/if}
{/if}
</form>
</div>
<script>
( function($) {
var $section = $("#wa-step-details-section"),
$wrapper = $("#wa-order-form-wrapper");
var ready_promise = $wrapper.data("ready").promise();
ready_promise.then( function(controller) {
controller.initDetails({
$wrapper: $section,
errors: {$_errors|json_encode}
});
});
})(jQuery);
</script>
</section>
{/strip}