|
@@ -0,0 +1,99 @@
|
|
|
+<?php
|
|
|
+ $url = route('admin.surveys');
|
|
|
+?>
|
|
|
+<style>
|
|
|
+ #admin-surveys-filters label {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ #admin-surveys-filters .mw-100px {
|
|
|
+ min-width: 100px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .filter-container {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ .filter-container>div {
|
|
|
+ width: 165px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .filter-container>div:not(:last-child) {
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sm-section {
|
|
|
+ width: auto !important;
|
|
|
+ }
|
|
|
+</style>
|
|
|
+<form id="admin-surveys-filters" method="GET" action="{{ $url }}" class="filter-container" v-cloak>
|
|
|
+ <div class="sm-section">
|
|
|
+ <div class="">
|
|
|
+ <label>Filter String:</label>
|
|
|
+ <input name="string" class="form-control input-sm" v-model="filters.string">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="sm-section">
|
|
|
+ <div class="">
|
|
|
+ <label>Entity Type:</label>
|
|
|
+ <select name="entity_type" class="form-control input-sm" v-model="filters.entity_type">
|
|
|
+ @foreach ($entityTypes as $entityType)
|
|
|
+ <option value="{{ $entityType }}">{{ formatAsTitle($entityType) }}</option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <div class="">
|
|
|
+ <label> </label>
|
|
|
+ <div class=" d-flex">
|
|
|
+ <button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
|
|
|
+ <a href="#" v-on:click.prevent="fastLoad('{{ $url }}')" class="btn btn-link btn-sm text-danger">Clear</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</form>
|
|
|
+
|
|
|
+<?php
|
|
|
+$loadedFilters = @$filters;
|
|
|
+$allFilterKeys = [
|
|
|
+ 'string',
|
|
|
+ 'entity_type'
|
|
|
+];
|
|
|
+for ($i = 0; $i < count($allFilterKeys); $i++) {
|
|
|
+ if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
|
|
|
+ $loadedFilters[$allFilterKeys[$i]] = '';
|
|
|
+ }
|
|
|
+}
|
|
|
+?>
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
+ function init() {
|
|
|
+ new Vue({
|
|
|
+ el: '#admin-surveys-filters',
|
|
|
+ delimiters: ['@{{', '}}'],
|
|
|
+ data: {
|
|
|
+ filters: <?= json_encode($loadedFilters) ?>
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init: function() {
|
|
|
+
|
|
|
+ },
|
|
|
+ doSubmit: function() {
|
|
|
+ fastLoad("{{ $url }}?" + $('#admin-surveys-filters').serialize());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted: function() {
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ addMCInitializer('admin-surveys-filters', init, '#admin-surveys-filters');
|
|
|
+ })();
|
|
|
+</script>
|