DmitrMakeev commited on
Commit
1b9bb85
1 Parent(s): 9722b56

Update data_gc_tab.html

Browse files
Files changed (1) hide show
  1. data_gc_tab.html +42 -21
data_gc_tab.html CHANGED
@@ -92,7 +92,40 @@
92
  <h1>База синхронизации с GetCourse</h1>
93
  </div>
94
  <div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  <input id="filter-value" type="text" placeholder="value to filter">
 
96
  <button id="filter-clear">Clear Filter</button>
97
  </div>
98
  <div id="example-table"></div>
@@ -172,41 +205,29 @@
172
  });
173
 
174
  // Define variables for input elements
 
 
175
  var valueEl = document.getElementById("filter-value");
176
 
177
  // Trigger setFilter function with correct parameters
178
  function updateFilter() {
179
- var filterVal = valueEl.value;
 
180
 
181
  if (filterVal) {
182
- table.setFilter([
183
- {field: "id", type: "like", value: filterVal},
184
- {field: "name", type: "like", value: filterVal},
185
- {field: "phone", type: "like", value: filterVal},
186
- {field: "email", type: "like", value: filterVal},
187
- {field: "curator", type: "like", value: filterVal},
188
- {field: "shop_statys_full", type: "like", value: filterVal},
189
- {field: "ad_url", type: "like", value: filterVal},
190
- {field: "vk_id", type: "like", value: filterVal},
191
- {field: "chat_id", type: "like", value: filterVal},
192
- {field: "ws_statys", type: "like", value: filterVal},
193
- {field: "ws_stop", type: "like", value: filterVal},
194
- {field: "web_statys", type: "like", value: filterVal},
195
- {field: "fin_progress", type: "like", value: filterVal},
196
- {field: "pr1", type: "like", value: filterVal},
197
- {field: "pr2", type: "like", value: filterVal},
198
- {field: "pr3", type: "like", value: filterVal},
199
- {field: "pr4", type: "like", value: filterVal},
200
- {field: "pr5", type: "like", value: filterVal}
201
- ]);
202
  }
203
  }
204
 
205
  // Update filters on value change
 
 
206
  document.getElementById("filter-value").addEventListener("keyup", updateFilter);
207
 
208
  // Clear filters on "Clear Filters" button click
209
  document.getElementById("filter-clear").addEventListener("click", function() {
 
 
210
  valueEl.value = "";
211
  table.clearFilter();
212
  });
 
92
  <h1>База синхронизации с GetCourse</h1>
93
  </div>
94
  <div>
95
+ <select id="filter-field">
96
+ <option></option>
97
+ <option value="id">Номер в списке</option>
98
+ <option value="name">Имя</option>
99
+ <option value="phone">Телефон</option>
100
+ <option value="email">Email</option>
101
+ <option value="curator">Куратор</option>
102
+ <option value="shop_statys_full">Статус покупки</option>
103
+ <option value="ad_url">Ссылка на пользователя в GC</option>
104
+ <option value="vk_id">Ссылка на VK</option>
105
+ <option value="chat_id">Ссылка на Tg</option>
106
+ <option value="ws_statys">Статус WhatsApp</option>
107
+ <option value="ws_stop">Стутус подписки</option>
108
+ <option value="web_statys">Вебинары</option>
109
+ <option value="fin_progress">Прогрес по воронке</option>
110
+ <option value="pr1">utm_source</option>
111
+ <option value="pr2">utm_medium</option>
112
+ <option value="pr3">utm_campaign</option>
113
+ <option value="pr4">utm_term</option>
114
+ <option value="pr5">utm_content</option>
115
+ </select>
116
+
117
+ <select id="filter-type">
118
+ <option value="=">=</option>
119
+ <option value="<"><</option>
120
+ <option value="<="><=</option>
121
+ <option value=">">></option>
122
+ <option value=">=">>=</option>
123
+ <option value="!=">!=</option>
124
+ <option value="like">like</option>
125
+ </select>
126
+
127
  <input id="filter-value" type="text" placeholder="value to filter">
128
+
129
  <button id="filter-clear">Clear Filter</button>
130
  </div>
131
  <div id="example-table"></div>
 
205
  });
206
 
207
  // Define variables for input elements
208
+ var fieldEl = document.getElementById("filter-field");
209
+ var typeEl = document.getElementById("filter-type");
210
  var valueEl = document.getElementById("filter-value");
211
 
212
  // Trigger setFilter function with correct parameters
213
  function updateFilter() {
214
+ var filterVal = fieldEl.options[fieldEl.selectedIndex].value;
215
+ var typeVal = typeEl.options[typeEl.selectedIndex].value;
216
 
217
  if (filterVal) {
218
+ table.setFilter(filterVal, typeVal, valueEl.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
  }
221
 
222
  // Update filters on value change
223
+ document.getElementById("filter-field").addEventListener("change", updateFilter);
224
+ document.getElementById("filter-type").addEventListener("change", updateFilter);
225
  document.getElementById("filter-value").addEventListener("keyup", updateFilter);
226
 
227
  // Clear filters on "Clear Filters" button click
228
  document.getElementById("filter-clear").addEventListener("click", function() {
229
+ fieldEl.value = "";
230
+ typeEl.value = "=";
231
  valueEl.value = "";
232
  table.clearFilter();
233
  });