customer_approval.twig (9466B)
1 {{ header }}{{ column_left }} 2 <div id="content"> 3 <div class="page-header"> 4 <div class="container-fluid"> 5 <div class="pull-right"><button type="button" data-toggle="tooltip" title="{{ button_filter }}" onclick="$('#filter-customer').toggleClass('hidden-sm hidden-xs');" class="btn btn-default hidden-md hidden-lg"><i class="fa fa-filter"></i></button></div> 6 <h1>{{ heading_title }}</h1> 7 <ul class="breadcrumb"> 8 {% for breadcrumb in breadcrumbs %} 9 <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li> 10 {% endfor %} 11 </ul> 12 </div> 13 </div> 14 <div class="container-fluid">{% if error_warning %} 15 <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }} 16 <button type="button" class="close" data-dismiss="alert">×</button> 17 </div> 18 {% endif %} 19 {% if success %} 20 <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }} 21 <button type="button" class="close" data-dismiss="alert">×</button> 22 </div> 23 {% endif %} 24 <div class="row"> 25 <div id="filter-customer" class="col-md-3 col-md-push-9 col-sm-12 hidden-sm hidden-xs"> 26 <div class="panel panel-default"> 27 <div class="panel-heading"> 28 <h3 class="panel-title"><i class="fa fa-filter"></i> {{ text_filter }}</h3> 29 </div> 30 <div class="panel-body"> 31 <div class="form-group"> 32 <label class="control-label" for="input-name">{{ entry_name }}</label> 33 <input type="text" name="filter_name" value="{{ filter_name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" /> 34 </div> 35 <div class="form-group"> 36 <label class="control-label" for="input-email">{{ entry_email }}</label> 37 <input type="text" name="filter_email" value="{{ filter_email }}" placeholder="{{ entry_email }}" id="input-email" class="form-control" /> 38 </div> 39 <div class="form-group"> 40 <label class="control-label" for="input-customer-group">{{ entry_customer_group }}</label> 41 <select name="filter_customer_group_id" id="input-customer-group" class="form-control"> 42 <option value=""></option> 43 44 45 {% for customer_group in customer_groups %} 46 {% if customer_group.customer_group_id == filter_customer_group_id %} 47 48 49 <option value="{{ customer_group.customer_group_id }}" selected="selected">{{ customer_group.name }}</option> 50 51 52 {% else %} 53 54 55 <option value="{{ customer_group.customer_group_id }}">{{ customer_group.name }}</option> 56 57 58 {% endif %} 59 {% endfor %} 60 61 62 </select> 63 </div> 64 <div class="form-group"> 65 <label class="control-label" for="input-type">{{ entry_type }}</label> 66 <select name="filter_type" id="input-type" class="form-control"> 67 <option value=""></option> 68 69 70 {% if filter_type == 'customer' %} 71 72 73 <option value="customer" selected="selected">{{ text_customer }}</option> 74 75 76 {% else %} 77 78 79 <option value="customer">{{ text_customer }}</option> 80 81 82 {% endif %} 83 {% if filter_type == 'affiliate' %} 84 85 86 <option value="affiliate" selected="selected">{{ text_affiliate }}</option> 87 88 89 {% else %} 90 91 92 <option value="affiliate">{{ text_affiliate }}</option> 93 94 95 {% endif %} 96 97 98 </select> 99 </div> 100 <div class="form-group"> 101 <label class="control-label" for="input-date-added">{{ entry_date_added }}</label> 102 <div class="input-group date"> 103 <input type="text" name="filter_date_added" value="{{ filter_date_added }}" placeholder="{{ entry_date_added }}" data-date-format="YYYY-MM-DD" id="input-date-added" class="form-control" /> 104 <span class="input-group-btn"> 105 <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button> 106 </span></div> 107 </div> 108 <div class="form-group text-right"> 109 <button type="button" id="button-filter" class="btn btn-default"><i class="fa fa-filter"></i> {{ button_filter }}</button> 110 </div> 111 </div> 112 </div> 113 </div> 114 <div class="col-md-9 col-md-pull-3 col-sm-12"> 115 <div class="panel panel-default"> 116 <div class="panel-heading"> 117 <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3> 118 </div> 119 <div class="panel-body"> 120 <div id="customer-approval"></div> 121 </div> 122 </div> 123 </div> 124 </div> 125 </div> 126 <script type="text/javascript"><!-- 127 $('#customer-approval').delegate('.pagination a', 'click', function(e) { 128 e.preventDefault(); 129 130 $('#customer-approval').load(this.href); 131 }); 132 133 $('#customer-approval').load('index.php?route=customer/customer_approval/customer_approval&user_token={{ user_token }}'); 134 135 $('#customer-approval').on('click', '.btn-success, .btn-danger', function(e) { 136 e.preventDefault(); 137 138 var element = this; 139 140 $.ajax({ 141 url: $(element).attr('href'), 142 dataType: 'json', 143 beforeSend: function() { 144 $(element).button('loading'); 145 }, 146 complete: function() { 147 $(element).button('reset'); 148 }, 149 success: function(json) { 150 $('.alert-dismissible').remove(); 151 152 if (json['error']) { 153 $('#customer-approval').before('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); 154 } 155 156 if (json['success']) { 157 $('#customer-approval').load('index.php?route=customer/customer_approval/customer_approval&user_token={{ user_token }}'); 158 159 $('#customer-approval').before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">×</button></div>'); 160 } 161 }, 162 error: function(xhr, ajaxOptions, thrownError) { 163 alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 164 } 165 }); 166 }); 167 168 $('#button-filter').on('click', function() { 169 url = ''; 170 171 var filter_name = $('input[name=\'filter_name\']').val(); 172 173 if (filter_name) { 174 url += '&filter_name=' + encodeURIComponent(filter_name); 175 } 176 177 var filter_email = $('input[name=\'filter_email\']').val(); 178 179 if (filter_email) { 180 url += '&filter_email=' + encodeURIComponent(filter_email); 181 } 182 183 var filter_customer_group_id = $('select[name=\'filter_customer_group_id\']').val(); 184 185 if (filter_customer_group_id !== '') { 186 url += '&filter_customer_group_id=' + encodeURIComponent(filter_customer_group_id); 187 } 188 189 var filter_type = $('select[name=\'filter_type\']').val(); 190 191 if (filter_type !== '') { 192 url += '&filter_type=' + filter_type; 193 } 194 195 var filter_date_added = $('input[name=\'filter_date_added\']').val(); 196 197 if (filter_date_added) { 198 url += '&filter_date_added=' + encodeURIComponent(filter_date_added); 199 } 200 201 $('#customer-approval').load('index.php?route=customer/customer_approval/customer_approval&user_token={{ user_token }}' + url); 202 }); 203 //--></script> 204 <script type="text/javascript"><!-- 205 $('input[name=\'filter_name\']').autocomplete({ 206 'source': function(request, response) { 207 $.ajax({ 208 url: 'index.php?route=customer/customer/autocomplete&user_token={{ user_token }}&filter_name=' + encodeURIComponent(request), 209 dataType: 'json', 210 success: function(json) { 211 response($.map(json, function(item) { 212 return { 213 label: item['name'], 214 value: item['customer_id'] 215 } 216 })); 217 } 218 }); 219 }, 220 'select': function(item) { 221 $('input[name=\'filter_name\']').val(item['label']); 222 } 223 }); 224 225 $('input[name=\'filter_email\']').autocomplete({ 226 'source': function(request, response) { 227 $.ajax({ 228 url: 'index.php?route=customer/customer/autocomplete&user_token={{ user_token }}&filter_email=' + encodeURIComponent(request), 229 dataType: 'json', 230 success: function(json) { 231 response($.map(json, function(item) { 232 return { 233 label: item['email'], 234 value: item['customer_id'] 235 } 236 })); 237 } 238 }); 239 }, 240 'select': function(item) { 241 $('input[name=\'filter_email\']').val(item['label']); 242 } 243 }); 244 //--></script> 245 <script type="text/javascript"><!-- 246 $('.date').datetimepicker({ 247 language: '{{ datepicker }}', 248 pickTime: false 249 }); 250 //--></script></div> 251 {{ footer }}