edit.twig (17595B)
1 {{ header }} 2 <div id="account-edit" 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 <form action="{{ action }}" method="post" enctype="multipart/form-data" class="form-horizontal"> 22 <fieldset> 23 <legend>{{ text_your_details }}</legend> 24 <div class="form-group required"> 25 <label class="col-sm-2 control-label" for="input-firstname">{{ entry_firstname }} </label> 26 <div class="col-sm-10"> 27 <input type="text" name="firstname" value="{{ firstname }}" placeholder="{{ entry_firstname }}" id="input-firstname" class="form-control" /> 28 {% if error_firstname %} 29 <div class="text-danger">{{ error_firstname }}</div> 30 {% endif %} 31 </div> 32 </div> 33 <div class="form-group required"> 34 <label class="col-sm-2 control-label" for="input-lastname">{{ entry_lastname }}</label> 35 <div class="col-sm-10"> 36 <input type="text" name="lastname" value="{{ lastname }}" placeholder="{{ entry_lastname }}" id="input-lastname" class="form-control" /> 37 {% if error_lastname %} 38 <div class="text-danger">{{ error_lastname }}</div> 39 {% endif %} 40 </div> 41 </div> 42 <div class="form-group required"> 43 <label class="col-sm-2 control-label" for="input-email">{{ entry_email }}</label> 44 <div class="col-sm-10"> 45 <input type="email" name="email" value="{{ email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control" /> 46 {% if error_email %} 47 <div class="text-danger">{{ error_email }}</div> 48 {% endif %} 49 </div> 50 </div> 51 <div class="form-group required"> 52 <label class="col-sm-2 control-label" for="input-telephone">{{ entry_telephone }}</label> 53 <div class="col-sm-10"> 54 <input type="tel" name="telephone" value="{{ telephone }}" placeholder="{{ entry_telephone }}" id="input-telephone" class="form-control" /> 55 {% if error_telephone %} 56 <div class="text-danger">{{ error_telephone }}</div> 57 {% endif %} 58 </div> 59 </div> 60 {% for custom_field in custom_fields %} 61 {% if custom_field.type == 'select' %} 62 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 63 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 64 <div class="col-sm-10"> 65 <select name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" id="input-custom-field{{ custom_field.custom_field_id }}" class="form-control"> 66 <option value="">{{ text_select }}</option> 67 {% for custom_field_value in custom_field.custom_field_value %} 68 {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %} 69 <option value="{{ custom_field_value.custom_field_value_id }}" selected="selected">{{ custom_field_value.name }}</option> 70 {% else %} 71 <option value="{{ custom_field_value.custom_field_value_id }}">{{ custom_field_value.name }}</option> 72 {% endif %} 73 {% endfor %} 74 </select> 75 {% if error_custom_field[custom_field.custom_field_id] %} 76 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 77 {% endif %} 78 </div> 79 </div> 80 {% endif %} 81 {% if custom_field.type == 'radio' %} 82 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 83 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 84 <div class="col-sm-10"> 85 <div> 86 {% for custom_field_value in custom_field.custom_field_value %} 87 <div class="radio"> 88 {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id == account_custom_field[custom_field.custom_field_id] %} 89 <label> 90 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" /> 91 {{ custom_field_value.name }}</label> 92 {% else %} 93 <label> 94 <input type="radio" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{{ custom_field_value.custom_field_value_id }}" /> 95 {{ custom_field_value.name }}</label> 96 {% endif %} 97 </div> 98 {% endfor %} 99 </div> 100 {% if error_custom_field[custom_field.custom_field_id] %} 101 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 102 {% endif %} 103 </div> 104 </div> 105 {% endif %} 106 {% if custom_field.type == 'checkbox' %} 107 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 108 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 109 <div class="col-sm-10"> 110 <div> 111 {% for custom_field_value in custom_field.custom_field_value %} 112 <div class="checkbox"> 113 {% if account_custom_field[custom_field.custom_field_id] and custom_field_value.custom_field_value_id in account_custom_field[custom_field.custom_field_id] %} 114 <label> 115 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" checked="checked" /> 116 {{ custom_field_value.name }}</label> 117 {% else %} 118 <label> 119 <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}" /> 120 {{ custom_field_value.name }}</label> 121 {% endif %} 122 </div> 123 {% endfor %} 124 </div> 125 {% if error_custom_field[custom_field.custom_field_id] %} 126 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 127 {% endif %} 128 </div> 129 </div> 130 {% endif %} 131 {% if custom_field.type == 'text' %} 132 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 133 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 134 <div class="col-sm-10"> 135 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_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" /> 136 {% if error_custom_field[custom_field.custom_field_id] %} 137 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 138 {% endif %} 139 </div> 140 </div> 141 {% endif %} 142 {% if custom_field.type == 'textarea' %} 143 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 144 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 145 <div class="col-sm-10"> 146 <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 account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }}{% else %}{{ custom_field.value }}{% endif %}</textarea> 147 {% if error_custom_field[custom_field.custom_field_id] %} 148 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 149 {% endif %} 150 </div> 151 </div> 152 {% endif %} 153 {% if custom_field.type == 'file' %} 154 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 155 <label class="col-sm-2 control-label">{{ custom_field.name }}</label> 156 <div class="col-sm-10"> 157 <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> 158 <input type="hidden" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_custom_field[custom_field.custom_field_id] }} {% endif %}" /> 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 %} 162 </div> 163 </div> 164 {% endif %} 165 {% if custom_field.type == 'date' %} 166 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 167 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 168 <div class="col-sm-10"> 169 <div class="input-group date"> 170 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_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" /> 171 <span class="input-group-btn"> 172 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 173 </span></div> 174 {% if error_custom_field[custom_field.custom_field_id] %} 175 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 176 {% endif %} 177 </div> 178 </div> 179 {% endif %} 180 {% if custom_field.type == 'time' %} 181 <div class="form-group{% if custom_field.required %} required {% endif %} custom-field" data-sort="{{ custom_field.sort_order }}"> 182 <label class="col-sm-2 control-label" for="input-custom-field{{ custom_field.custom_field_id }}">{{ custom_field.name }}</label> 183 <div class="col-sm-10"> 184 <div class="input-group time"> 185 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_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" /> 186 <span class="input-group-btn"> 187 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 188 </span></div> 189 {% if error_custom_field[custom_field.custom_field_id] %} 190 <div class="text-danger">{{ error_custom_field[custom_field.custom_field_id] }}</div> 191 {% endif %} 192 </div> 193 </div> 194 {% endif %} 195 {% if custom_field.type == 'time' %} 196 <div class="form-group{% if custom_field.required %} required {% endif %} 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 datetime"> 200 <input type="text" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}]" value="{% if account_custom_field[custom_field.custom_field_id] %}{{ account_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" /> 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 %} 207 </div> 208 </div> 209 {% endif %} 210 {% endfor %} 211 </fieldset> 212 <div class="buttons clearfix"> 213 <div class="pull-left"><a href="{{ back }}" class="btn btn-default">{{ button_back }}</a></div> 214 <div class="pull-right"> 215 <input type="submit" value="{{ button_continue }}" class="btn btn-primary" /> 216 </div> 217 </div> 218 </form> 219 {{ content_bottom }}</div> 220 {{ column_right }}</div> 221 </div> 222 <script type="text/javascript"><!-- 223 // Sort the custom fields 224 $('.form-group[data-sort]').detach().each(function() { 225 if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('.form-group').length) { 226 $('.form-group').eq($(this).attr('data-sort')).before(this); 227 } 228 229 if ($(this).attr('data-sort') > $('.form-group').length) { 230 $('.form-group:last').after(this); 231 } 232 233 if ($(this).attr('data-sort') == $('.form-group').length) { 234 $('.form-group:last').after(this); 235 } 236 237 if ($(this).attr('data-sort') < -$('.form-group').length) { 238 $('.form-group:first').before(this); 239 } 240 }); 241 //--></script> 242 <script type="text/javascript"><!-- 243 $('button[id^=\'button-custom-field\']').on('click', function() { 244 var element = this; 245 246 $('#form-upload').remove(); 247 248 $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>'); 249 250 $('#form-upload input[name=\'file\']').trigger('click'); 251 252 if (typeof timer != 'undefined') { 253 clearInterval(timer); 254 } 255 256 timer = setInterval(function() { 257 if ($('#form-upload input[name=\'file\']').val() != '') { 258 clearInterval(timer); 259 260 $.ajax({ 261 url: 'index.php?route=tool/upload', 262 type: 'post', 263 dataType: 'json', 264 data: new FormData($('#form-upload')[0]), 265 cache: false, 266 contentType: false, 267 processData: false, 268 beforeSend: function() { 269 $(element).button('loading'); 270 }, 271 complete: function() { 272 $(element).button('reset'); 273 }, 274 success: function(json) { 275 $(element).parent().find('.text-danger').remove(); 276 277 if (json['error']) { 278 $(element).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>'); 279 } 280 281 if (json['success']) { 282 alert(json['success']); 283 284 $(element).parent().find('input').val(json['code']); 285 } 286 }, 287 error: function(xhr, ajaxOptions, thrownError) { 288 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 289 } 290 }); 291 } 292 }, 500); 293 }); 294 //--></script> 295 <script type="text/javascript"><!-- 296 $('.date').datetimepicker({ 297 language: '{{ datepicker }}', 298 pickTime: false 299 }); 300 301 $('.datetime').datetimepicker({ 302 language: '{{ datepicker }}', 303 pickDate: true, 304 pickTime: true 305 }); 306 307 $('.time').datetimepicker({ 308 language: '{{ datepicker }}', 309 pickDate: false 310 }); 311 //--></script> 312 {{ footer }}