diff --git a/src/classes/tainacan-creator.php b/src/classes/tainacan-creator.php index efd74f176..75a3837f6 100644 --- a/src/classes/tainacan-creator.php +++ b/src/classes/tainacan-creator.php @@ -147,7 +147,6 @@ $Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance(); //register filter type $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Numeric'); -$Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Custom_Numeric'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Date'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Selectbox'); $Tainacan_Filters->register_filter_type('Tainacan\Filter_Types\Autocomplete'); diff --git a/src/views/admin/components/filter-types/custom-numeric/class-tainacan-custom-numeric.php b/src/views/admin/components/filter-types/custom-numeric/class-tainacan-custom-numeric.php deleted file mode 100644 index 85ad92ac9..000000000 --- a/src/views/admin/components/filter-types/custom-numeric/class-tainacan-custom-numeric.php +++ /dev/null @@ -1,250 +0,0 @@ -set_name( __('Custom Numeric', 'tainacan') ); - $this->set_supported_types(['float']); - $this->set_component('tainacan-filter-custom-numeric'); - $this->set_script(' - var TainacanExtraFilters = TainacanExtraFilters ? TainacanExtraFilters : {}; - - const TainacanFilterCustomNumeric = { - name: "TainacanFilterCustomNumeric", - props: { - filter: Object, - query: Object, - isRepositoryLevel: Boolean, - isUsingElasticSearch: Boolean, - isLoadingItems: Boolean - }, - data: function() { - return { - collectionId: "", - metadatumId: "", - metadatumType: "", - filterTypeOptions: [], - value: null, - filterTypeOptions: [], - comparator: "=" - } - }, - computed: { - comparatorSymbol: function() { - switch(this.comparator) { - case "=": return "="; - case "!=": return "≠"; - case ">": return ">"; - case ">=": return "≥"; - case "<": return "<"; - case "<=": return "≤"; - default: return ""; - } - } - }, - watch: { - "query.metaquery": function() { - this.updateSelectedValues(); - }, - "query.taxquery": function() { - this.updateSelectedValues(); - } - }, - mounted: function() { console.log(this.filter, this.isRepositoryLevel, this.filterTypeOptions) }, - created: function() { - this.collectionId = this.filter.collection_id ? this.filter.collection_id : this.collectionId; - this.metadatumId = this.filter.metadatum.metadatum_id ? this.filter.metadatum.metadatum_id : this.metadatumId; - this.filterTypeOptions = this.filter.filter_type_options ? this.filter.filter_type_options : this.filterTypeOptions; - this.metadatumType = this.filter.metadatum.metadata_type_object && this.filter.metadatum.metadata_type_object.className ? this.filter.metadatum.metadata_type_object.className : this.metadatumType; - }, - methods: { - updateSelectedValues: function(){ - if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) ) - return false; - - let index = this.query.metaquery.findIndex(function(newMetadatum) { return newMetadatum.key == this.metadatumId } ); - - if ( index >= 0){ - let metadata = this.query.metaquery[ index ]; - - if ( metadata.value && metadata.value.length > 0) - this.value = Array.isArray(metadata.value) ? Number(metadata.value[0]) : Number(metadata.value); - - if ( metadata.compare) - this.comparator = metadata.compare; - - if (this.value != undefined) - this.$emit("sendValuesToTags", { label: this.comparator + " " + this.value, value: this.value }); - - } else { - this.value = null; - } - - }, - emit: function() { - - if ( this.value === null || this.value === "") - return; - - this.$emit("input", { - filter: "numeric", - compare: this.comparator, - metadatum_id: this.metadatumId, - collection_id: this.collectionId, - value: this.value, - type: "NUMERIC" - }); - - this.$emit("sendValuesToTags", { label: this.comparator + " " + this.value, value: this.value }); - - }, - onChangeComparator: function(newComparator) { - this.comparator = newComparator; - this.emit(); - } - }, - template: ` -
- -
-- -
-