1{{ header }} 2<div id="account-register" class="container"> 3 <ul class="breadcrumb"> 4 {% for breadcrumb in breadcrumbs %} 5 <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> 6 {% endfor %} 7 </ul> 8 {% if error_warning %} 9 <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}</div> 10 {% endif %} 11 <div class="row">{{ column_left }} 12 {% if column_left and column_right %} 13 {% set class = 'col-sm-6' %} 14 {% elseif column_left or column_right %} 15 {% set class = 'col-sm-9' %} 16 {% else %} 17 {% set class = 'col-sm-12' %} 18 {% endif %} 19 <div id="content" class="{{ class }}">{{ content_top }} 20 <h1>{{ heading_title }}</h1> 21 <p>{{ text_account_already }}</p> 22 <form action="{{ action }}" method="post" enctype="multipart/form-data" class="form-horizontal"> 23 <fieldset id="account"> 24 <legend>{{ text_your_details }}</legend> 25 <div class="form-group required" style="display: {% if customer_groups|length > 1 %} block {% else %} none {% endif %};"> 26 <label class="col-sm-2 control-label">{{ entry_customer_group }}</label> 27 <div class="col-sm-10">{% for customer_group in customer_groups %} 28 {% if customer_group.customer_group_id == customer_group_id %} 29 <div class="radio"> 30 <label> 31 <input type="radio" name="customer_group_id" value="{{ customer_group.customer_group_id }}" checked="checked" /> 32 {{ customer_group.name }}</label> 33 </div> 34 {% else %} 35 <div class="radio"> 36 <label> 37 <input type="radio" name="customer_group_id" value="{{ customer_group.customer_group_id }}" /> 38 {{ customer_group.name }}</label> 39 </div> 40 {% endif %} 41 {% endfor %}</div> 42 </div> 43 <div class="form-group required"> 44 <label class="col-sm-2 control-label" for="input-firstname">{{ entry_firstname }}</label> 45 <div class="col-sm-10"> 46 <input type="text" name="firstname" value="{{ firstname }}" placeholder="{{ entry_firstname }}" id="input-firstname" class="form-control" /> 47 {% if error_firstname %} 48 <div class="text-danger">{{ error_firstname }}</div> 49 {% endif %} </div> 50 </div> 51 <div class="form-group required"> 52 <label class="col-sm-2 control-label" for="input-lastname">{{ entry_lastname }}</label> 53 <div class="col-sm-10"> 54 <input type="text" name="lastname" value="{{ lastname }}" placeholder="{{ entry_lastname }}" id="input-lastname" class="form-control" /> 55 {% if error_lastname %} 56 <div class="text-danger">{{ error_lastname }}</div> 57 {% endif %} </div> 58 </div> 59 <div class="form-group required"> 60 <label class="col-sm-2 control-label" for="input-email">{{ entry_email }}</label> 61 <div class="col-sm-10"> 62 <input type="email" name="email" value="{{ email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control" /> 63 {% if error_email %} 64 <div class="text-danger">{{ error_email }}</div> 65 {% endif %} </div> 66 </div> 67 <div class="form-group required"> 68 <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label> 69 <div class="col-sm-10"> 70 <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" /> 71 {% if error_telephone %} 72 <div class="text-danger">{{ error_telephone }}</div> 73 {% endif %} </div> 74 </div> 75 {% for custom_field in custom_fields %} 76 {% if custom_field.type == 'select' %} 77 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 78 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 79 <div class="col-sm-10"> 80 <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control"> 81 <option value="">{{ text_select }}</option> 82 83 84 85 86 87 {% for custom_field_value in custom_field.custom_field_value %} 88 {% if register_custom_field[custom_field.location][custom_field.custom_field_id] and custom_field_value.custom_field_value_id == register_custom_field[custom_field.custom_field_id] %} 89 90 91 92 93 <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option> 94 95 96 97 98 99 {% else %} 100 101 102 103 104 105 <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option> 106 107 108 109 110 111 {% endif %} 112 {% endfor %} 113 114 115 116 117 118 </select> 119 {% if error_custom_field[custom_field.custom_field_id] %} 120 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 121 {% endif %}</div> 122 </div> 123 {% endif %} 124 {% if custom_field.type == 'radio' %} 125 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 126 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 127 <div class="col-sm-10"> 128 <div> {% for custom_field_value in custom_field.custom_field_value %} 129 <div class="radio">{% if register_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == register_custom_field[custom_field.custom_field_id] %} 130 <label> 131 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" /> 132 {{ custom_field_value.name }}</label> 133 {% else %} 134 <label> 135 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" /> 136 {{ custom_field_value.name }}</label> 137 {% endif %} </div> 138 {% endfor %}</div> 139 {% if error_custom_field[custom_field.custom_field_id] %} 140 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 141 {% endif %}</div> 142 </div> 143 {% endif %} 144 {% if custom_field.type == 'checkbox' %} 145 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 146 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 147 <div class="col-sm-10"> 148 <div> {% for custom_field_value in custom_field.custom_field_value %} 149 <div class="checkbox">{% if register_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in register_custom_field[custom_field.custom_field_id] %} 150 <label> 151 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" /> 152 {{ custom_field_value.name }}</label> 153 {% else %} 154 <label> 155 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" /> 156 {{ custom_field_value.name }}</label> 157 {% endif %} </div> 158 {% endfor %} </div> 159 {% if error_custom_field[custom_field.custom_field_id] %} 160 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 161 {% endif %} </div> 162 </div> 163 {% endif %} 164 {% if custom_field.type == 'text' %} 165 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 166 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 167 <div class="col-sm-10"> 168 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if register_custom_field[custom_field.custom_field_id] %}{{ register_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 169 {% if error_custom_field[custom_field.custom_field_id] %} 170 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 171 {% endif %} </div> 172 </div> 173 {% endif %} 174 {% if custom_field.type == 'textarea' %} 175 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 176 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 177 <div class="col-sm-10"> 178 <textarea name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" rows="5" placeholder="{{ custom_field.name }}" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control">{% if register_custom_field[custom_field.custom_field_id] %}{{ register_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}</textarea> 179 {% if error_custom_field[custom_field.custom_field_id] %} 180 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 181 {% endif %} </div> 182 </div> 183 {% endif %} 184 {% if custom_field.type == 'file' %} 185 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 186 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 187 <div class="col-sm-10"> 188 <button type="button" id="button-custom-field{{ custom_field.custom_field_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button> 189 <input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if register_custom_field[custom_field.custom_field_id] %} {{ register_custom_field[custom_field.custom_field_id] }} {% endif %}" /> 190 {% if error_custom_field[custom_field.custom_field_id] %} 191 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 192 {% endif %}</div> 193 </div> 194 {% endif %} 195 {% if custom_field.type == 'date' %} 196 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 197 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 198 <div class="col-sm-10"> 199 <div class="input-group date"> 200 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if register_custom_field[custom_field.custom_field_id] %}{{ register_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 201 <span class="input-group-btn"> 202 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 203 </span></div> 204 {% if error_custom_field[custom_field.custom_field_id] %} 205 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 206 {% endif %} </div> 207 </div> 208 {% endif %} 209 {% if custom_field.type == 'time' %} 210 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 211 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 212 <div class="col-sm-10"> 213 <div class="input-group time"> 214 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if register_custom_field[custom_field.custom_field_id] %}{{ register_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" data-date-format="HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 215 <span class="input-group-btn"> 216 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 217 </span></div> 218 {% if error_custom_field[custom_field.custom_field_id] %} 219 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 220 {% endif %} </div> 221 </div> 222 {% endif %} 223 {% if custom_field.type == 'datetime' %} 224 <div id="custom-field{{ custom_field.custom_field_id }}" class="form-group custom-field" data-sort="{{ custom_field.sort_order }}"> 225 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 226 <div class="col-sm-10"> 227 <div class="input-group datetime"> 228 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if register_custom_field[custom_field.custom_field_id] %}{{ register_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}" placeholder="{{ custom_field.name }}" data-date-format="YYYY-MM-DD HH:mm" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control" /> 229 <span class="input-group-btn"> 230 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 231 </span></div> 232 {% if error_custom_field[custom_field.custom_field_id] %} 233 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 234 {% endif %} </div> 235 </div> 236 {% endif %} 237 {% endfor %} 238 </fieldset> 239 <fieldset> 240 <legend>{{ text_your_password }}</legend> 241 <div class="form-group required"> 242 <label class="col-sm-2 control-label" for="input-password">{{ entry_password }}</label> 243 <div class="col-sm-10"> 244 <input type="password" name="password" value="{{ password }}" placeholder="{{ entry_password }}" id="input-password" class="form-control" /> 245 {% if error_password %} 246 <div class="text-danger">{{ error_password }}</div> 247 {% endif %} </div> 248 </div> 249 <div class="form-group required"> 250 <label class="col-sm-2 control-label" for="input-confirm">{{ entry_confirm }}</label> 251 <div class="col-sm-10"> 252 <input type="password" name="confirm" value="{{ confirm }}" placeholder="{{ entry_confirm }}" id="input-confirm" class="form-control" /> 253 {% if error_confirm %} 254 <div class="text-danger">{{ error_confirm }}</div> 255 {% endif %} </div> 256 </div> 257 </fieldset> 258 <fieldset> 259 <legend>{{ text_newsletter }}</legend> 260 <div class="form-group"> 261 <label class="col-sm-2 control-label">{{ entry_newsletter }}</label> 262 <div class="col-sm-10"> {% if newsletter %} 263 <label class="radio-inline"> 264 <input type="radio" name="newsletter" value="1" checked="checked" /> 265 {{ text_yes }}</label> 266 <label class="radio-inline"> 267 <input type="radio" name="newsletter" value="0" /> 268 {{ text_no }}</label> 269 {% else %} 270 <label class="radio-inline"> 271 <input type="radio" name="newsletter" value="1" /> 272 {{ text_yes }}</label> 273 <label class="radio-inline"> 274 <input type="radio" name="newsletter" value="0" checked="checked" /> 275 {{ text_no }}</label> 276 {% endif %} </div> 277 </div> 278 </fieldset> 279 {{ captcha }} 280 {% if text_agree %} 281 <div class="buttons"> 282 <div class="pull-right">{{ text_agree }} 283 {% if agree %} 284 <input type="checkbox" name="agree" value="1" checked="checked" /> 285 {% else %} 286 <input type="checkbox" name="agree" value="1" /> 287 {% endif %} 288 289 <input type="submit" value="{{ button_continue }}" class="btn btn-primary" /> 290 </div> 291 </div> 292 {% else %} 293 <div class="buttons"> 294 <div class="pull-right"> 295 <input type="submit" value="{{ button_continue }}" class="btn btn-primary" /> 296 </div> 297 </div> 298 {% endif %} 299 </form> 300 {{ content_bottom }}</div> 301 {{ column_right }}</div> 302</div> 303<script type="text/javascript"><!-- 304// Sort the custom fields 305$('#account .form-group[data-sort]').detach().each(function() { 306 if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('#account .form-group').length) { 307 $('#account .form-group').eq($(this).attr('data-sort')).before(this); 308 } 309 310 if ($(this).attr('data-sort') > $('#account .form-group').length) { 311 $('#account .form-group:last').after(this); 312 } 313 314 if ($(this).attr('data-sort') == $('#account .form-group').length) { 315 $('#account .form-group:last').after(this); 316 } 317 318 if ($(this).attr('data-sort') < -$('#account .form-group').length) { 319 $('#account .form-group:first').before(this); 320 } 321}); 322 323$('input[name=\'customer_group_id\']').on('change', function() { 324 $.ajax({ 325 url: 'index.php?route=account/register/customfield&customer_group_id=' + this.value, 326 dataType: 'json', 327 success: function(json) { 328 $('.custom-field').hide(); 329 $('.custom-field').removeClass('required'); 330 331 for (i = 0; i < json.length; i++) { 332 custom_field = json[i]; 333 334 $('#custom-field' + custom_field['custom_field_id']).show(); 335 336 if (custom_field['required']) { 337 $('#custom-field' + custom_field['custom_field_id']).addClass('required'); 338 } 339 } 340 }, 341 error: function(xhr, ajaxOptions, thrownError) { 342 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 343 } 344 }); 345}); 346 347$('input[name=\'customer_group_id\']:checked').trigger('change'); 348//--></script> 349<script type="text/javascript"><!-- 350$('button[id^=\'button-custom-field\']').on('click', function() { 351 var element = this; 352 353 $('#form-upload').remove(); 354 355 $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>'); 356 357 $('#form-upload input[name=\'file\']').trigger('click'); 358 359 if (typeof timer != 'undefined') { 360 clearInterval(timer); 361 } 362 363 timer = setInterval(function() { 364 if ($('#form-upload input[name=\'file\']').val() != '') { 365 clearInterval(timer); 366 367 $.ajax({ 368 url: 'index.php?route=tool/upload', 369 type: 'post', 370 dataType: 'json', 371 data: new FormData($('#form-upload')[0]), 372 cache: false, 373 contentType: false, 374 processData: false, 375 beforeSend: function() { 376 $(element).button('loading'); 377 }, 378 complete: function() { 379 $(element).button('reset'); 380 }, 381 success: function(json) { 382 $(element).parent().find('.text-danger').remove(); 383 384 if (json['error']) { 385 $(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>'); 386 } 387 388 if (json['success']) { 389 alert(json['success']); 390 391 $(element).parent().find('input').val(json['code']); 392 } 393 }, 394 error: function(xhr, ajaxOptions, thrownError) { 395 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 396 } 397 }); 398 } 399 }, 500); 400}); 401//--></script> 402<script type="text/javascript"><!-- 403$('.date').datetimepicker({ 404 language: '{{ datepicker }}', 405 pickTime: false 406}); 407 408$('.time').datetimepicker({ 409 language: '{{ datepicker }}', 410 pickDate: false 411}); 412 413$('.datetime').datetimepicker({ 414 language: '{{ datepicker }}', 415 pickDate: true, 416 pickTime: true 417}); 418//--></script> 419{{ footer }}