diff --git a/app/frontend/src/wells/components/SearchResults.vue b/app/frontend/src/wells/components/SearchResults.vue index 2a15045ca..b68534e5e 100644 --- a/app/frontend/src/wells/components/SearchResults.vue +++ b/app/frontend/src/wells/components/SearchResults.vue @@ -34,7 +34,7 @@ class="text-nowrap" scope="col"> {{ column.resultLabel ? column.resultLabel : column.label }} - { - if(a.text === 'Other') return 1; - if(b.text === 'Other') return -1; + options: [...WELL_TAGS_PUBLIC, ...WELL_TAGS_PRIVATE].sort((a, b) => { + if (a.text === 'Other') return 1; + if (b.text === 'Other') return -1; return a.text.toLowerCase().localeCompare(b.text.toLowerCase()) - }) + }), + sortable: false, }, streetOrCity: { param: 'street_address_or_city', label: 'Street address or city', - type: 'text' + type: 'text', + sortable: true, }, ownerName: { param: 'owner_full_name', label: 'Well owner', resultLabel: 'Owner name', - type: 'text' + type: 'text', + sortable: true, }, publicationStatus: { param: 'well_publication_status', @@ -57,137 +66,170 @@ const SEARCH_FIELDS = { label: 'Publication status', type: 'select', textField: 'description', - valueField: 'well_publication_status_code' + valueField: 'well_publication_status_code', + sortable: true, }, legal: { param: 'legal', label: 'Lot, Legal plan, District lot or PID', - type: 'text' + type: 'text', + sortable: true, }, landDistrict: { param: 'land_district', label: 'Land district', - type: 'select' + type: 'select', + sortable: true, }, wellStatus: { param: 'well_status', label: 'Well status', type: 'select', textField: 'description', - valueField: 'well_status_code' + valueField: 'well_status_code', + sortable: true, }, licencedStatus: { param: 'licenced_status', label: 'Well licence status', type: 'select', textField: 'description', - valueField: 'licenced_status_code' + valueField: 'licenced_status_code', + sortable: true, }, personResponsible: { param: 'person_responsible_name', sortParam: 'person_responsible__name', label: 'Person responsible for work', - type: 'text' + type: 'text', + sortable: true, }, personResponsibleGuid: { param: 'person_responsible', label: 'Person responsible for work', type: 'select', textField: 'name', - valueField: 'person_guid' + valueField: 'person_guid', + sortable: true, }, orgResponsible: { param: 'company_of_person_responsible_name', sortParam: 'company_of_person_responsible__name', label: 'Company that did the work', - type: 'text' + type: 'text', + sortable: true, }, orgResponsibleGuid: { param: 'company_of_person_responsible', label: 'Company that did the work', type: 'select', textField: 'name', - valueField: 'org_guid' + valueField: 'org_guid', + sortable: true, }, dateOfWork: { param: 'date_of_work', label: 'Date of work', - type: 'dateRange' + type: 'dateRange', + sortable: true, + }, + wellDepth: { + param: 'well_depth', + label: 'Well depth', + type: 'range', + sortable: true, + }, + aquiferNr: { + param: 'aquifer', + label: 'Aquifer number', + type: 'number', + sortable: true, }, - wellDepth: { param: 'well_depth', label: 'Well depth', type: 'range' }, - aquiferNr: { param: 'aquifer', label: 'Aquifer number', type: 'number' }, wellClass: { param: 'well_class', label: 'Class of well', type: 'select', textField: 'description', - valueField: 'well_class_code' + valueField: 'well_class_code', + sortable: true, }, wellSubclass: { param: 'well_subclass', label: 'Well subclass', - type: 'select' + type: 'select', + sortable: true, }, intendedWaterUse: { param: 'intended_water_use', label: 'Intended water use', type: 'select', textField: 'description', - valueField: 'intended_water_use_code' + valueField: 'intended_water_use_code', + sortable: true, }, boundaryEffect: { param: 'boundary_effect', label: 'Boundary effect', type: 'select', textField: 'description', - valueField: 'code' + valueField: 'code', + sortable: true, }, wellIdPlateAttached: { param: 'well_identification_plate_attached', label: 'Where ID plate attached', - type: 'text' + type: 'text', + sortable: true, }, idPlateAttachedBy: { param: 'id_plate_attached_by', label: 'ID plate attached by', - type: 'text' + type: 'text', + sortable: true, }, waterSupplySystemName: { param: 'water_supply_system_name', label: 'Water supply system name', - type: 'text' + type: 'text', + sortable: true, }, waterSupplyWellName: { param: 'water_supply_system_well_name', label: 'Water supply well name', - type: 'text' + type: 'text', + sortable: true, }, drillerName: { param: 'driller_name', label: 'Person who completed the work', - type: 'text' + type: 'text', + sortable: true, }, consultantName: { param: 'consultant_name', label: 'Consultant name', - type: 'text' + type: 'text', + sortable: true, }, consultantCompany: { param: 'consultant_company', label: 'Consultant company', - type: 'text' + type: 'text', + sortable: true, }, ownerMailingAddress: { authenticated: true, param: 'owner_mailing_address', label: 'Owner mailing address', - type: 'text' + type: 'text', + sortable: true, }, ownerCity: { authenticated: true, param: 'owner_city', label: 'Owner city', - type: 'text' + type: 'text', + sortable: true, }, ownerProvince: { authenticated: true, @@ -195,13 +237,15 @@ const SEARCH_FIELDS = { label: 'Owner province', type: 'select', textField: 'description', - valueField: 'province_state_code' + valueField: 'province_state_code', + sortable: true, }, ownerPostalCode: { authenticated: true, param: 'owner_postal_code', label: 'Owner postal code', - type: 'text' + type: 'text', + sortable: true, }, legalBlock: { param: 'legal_block', label: 'Block', type: 'text' }, legalSection: { param: 'legal_section', label: 'Section', type: 'text' }, @@ -210,369 +254,461 @@ const SEARCH_FIELDS = { locationDescription: { param: 'well_location_description', label: 'Description of well location', - type: 'text' + type: 'text', + sortable: true, }, coordinateAcquisitionCode: { param: 'coordinate_acquisition_code', label: 'Coordinate acquisition type', type: 'select', textField: 'description', - valueField: 'code' + valueField: 'code', + sortable: true, }, groundElevation: { param: 'ground_elevation', label: 'Ground elevation', - type: 'range' + type: 'range', + sortable: true, }, groundElevationMethod: { param: 'ground_elevation_method', label: 'Method for determining ground elevation', type: 'select', textField: 'description', - valueField: 'ground_elevation_method_code' + valueField: 'ground_elevation_method_code', + sortable: true, }, drillingMethods: { param: 'drilling_methods', label: 'Drilling methods', type: 'select', textField: 'description', - valueField: 'drilling_method_code' + valueField: 'drilling_method_code', + sortable: true, }, wellOrientationStatus: { param: 'well_orientation_status', label: 'Orientation of well', type: 'select', textField: 'description', - valueField: 'well_orientation_code' + valueField: 'well_orientation_code', + sortable: true, }, surfaceSealMaterial: { param: 'surface_seal_material', label: 'Suface seal material', type: 'select', textField: 'description', - valueField: 'surface_seal_material_code' + valueField: 'surface_seal_material_code', + sortable: true, }, surfaceSealDepth: { param: 'surface_seal_depth', label: 'Surface seal depth', - type: 'range' + type: 'range', + sortable: true, }, surfaceSealThickness: { param: 'surface_seal_thickness', label: 'Surface seal thickness', - type: 'range' + type: 'range', + sortable: true, }, surfaceSealMethod: { param: 'surface_seal_method', label: 'Surface seal method of installation', type: 'select', textField: 'description', - valueField: 'surface_seal_method_code' + valueField: 'surface_seal_method_code', + sortable: true, }, backfillAboveSurfaceSeal: { param: 'backfill_above_surface_seal', label: 'Backfill material above surface seal', - type: 'text' + type: 'text', + sortable: true, }, backfillDepth: { param: 'backfill_depth', label: 'Backfill depth', - type: 'range' + type: 'range', + sortable: true, }, linerMaterial: { param: 'liner_material', label: 'Liner material', type: 'select', textField: 'description', - valueField: 'code' + valueField: 'code', + sortable: true, }, linerDiameter: { param: 'liner_diameter', label: 'Liner diameter', - type: 'range' + type: 'range', + sortable: true, }, linerThickness: { param: 'liner_thickness', label: 'Liner thickness', - type: 'range' + type: 'range', + sortable: true, + }, + linerFrom: { + param: 'liner_from', + label: 'Liner from', + type: 'range', + sortable: true, + }, + linerTo: { + param: 'liner_to', + label: 'Liner to', + type: 'range', + sortable: true, + }, + linerRange: { + param: 'liner_range', + label: 'Liner from/to', + type: 'range', + sortable: true, }, - linerFrom: { param: 'liner_from', label: 'Liner from', type: 'range' }, - linerTo: { param: 'liner_to', label: 'Liner to', type: 'range' }, - linerRange: { param: 'liner_range', label: 'Liner from/to', type: 'range' }, screenIntakeMethod: { param: 'screen_intake_method', label: 'Screen intake', type: 'select', textField: 'description', - valueField: 'screen_intake_code' + valueField: 'screen_intake_code', + sortable: true, }, screenType: { param: 'screen_type', label: 'Screen type', type: 'select', textField: 'description', - valueField: 'screen_type_code' + valueField: 'screen_type_code', + sortable: true, }, screenMaterial: { param: 'screen_material', label: 'Screen material', type: 'select', textField: 'description', - valueField: 'screen_material_code' + valueField: 'screen_material_code', + sortable: true, }, otherScreenMaterial: { param: 'other_screen_material', label: 'Screen other material', - type: 'text' + type: 'text', + sortable: true, }, screenOpening: { param: 'screen_opening', label: 'Screen opening', type: 'select', textField: 'description', - valueField: 'screen_opening_code' + valueField: 'screen_opening_code', + sortable: true, }, screenBottom: { param: 'screen_bottom', label: 'Screen bottom', type: 'select', textField: 'description', - valueField: 'screen_bottom_code' + valueField: 'screen_bottom_code', + sortable: true, }, screenInformation: { param: 'screen_information', label: 'Screen information', - type: 'text' + type: 'text', + sortable: true, }, filterPackFrom: { param: 'filter_pack_from', label: 'Filter pack from', - type: 'range' + type: 'range', + sortable: true, }, filterPackTo: { param: 'filter_pack_to', label: 'Filter pack to', - type: 'range' + type: 'range', + sortable: true, }, filterPackRange: { param: 'filter_pack_range', label: 'Filter pack from/to', - type: 'range' + type: 'range', + sortable: true, }, filterPackMaterial: { param: 'filter_pack_material', label: 'Filter pack material', type: 'select', textField: 'description', - valueField: 'filter_pack_material_code' + valueField: 'filter_pack_material_code', + sortable: true, }, filterPackMaterialSize: { param: 'filter_pack_material_size', label: 'Filter pack material size', type: 'select', textField: 'description', - valueField: 'filter_pack_material_size_code' + valueField: 'filter_pack_material_size_code', + sortable: true, }, developmentMethods: { param: 'development_methods', label: 'Well development method', type: 'select', textField: 'description', - valueField: 'development_method_code' + valueField: 'development_method_code', + sortable: true, }, developmentHours: { param: 'development_hours', label: 'Development hours', - type: 'range' + type: 'range', + sortable: true, }, developmentNotes: { param: 'development_notes', label: 'Development notes', - type: 'text' + type: 'text', + sortable: true, }, yieldEstimationMethod: { param: 'yield_estimation_method', label: 'Yield estimation method', type: 'select', textField: 'description', - valueField: 'yield_estimation_method_code' + valueField: 'yield_estimation_method_code', + sortable: true, }, yieldEstimationRate: { param: 'yield_estimation_rate', label: 'Yield estimation rate', - type: 'range' + type: 'range', + sortable: true, }, yieldEstimationDuration: { param: 'yield_estimation_duration', label: 'Yield estimation duration', - type: 'range' + type: 'range', + sortable: true, }, staticLevelBeforeTest: { param: 'static_level_before_test', label: 'SWL before test', - type: 'range' + type: 'range', + sortable: true, }, hydroFracturingPerformed: { param: 'hydro_fracturing_performed', label: 'Hydro-fracturing performed', type: 'radio', - options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }] + options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }], + sortable: true, }, hydroFracturingYieldIncrease: { param: 'hydro_fracturing_yield_increase', label: 'Increase in well yield', - type: 'range' + type: 'range', + sortable: true, + }, + drawdown: { + param: 'drawdown', + label: 'Drawdown', + type: 'range', + sortable: true, }, - drawdown: { param: 'drawdown', label: 'Drawdown', type: 'range' }, recommendedPumpDepth: { param: 'recommended_pump_depth', label: 'Recommended pump depth', - type: 'range' + type: 'range', + sortable: true, }, recommendedPumpRate: { param: 'recommended_pump_rate', label: 'Recommended pump rate', - type: 'range' + type: 'range', + sortable: true, }, waterQualityCharacteristics: { param: 'water_quality_characteristics', label: 'Water quality characteristics', type: 'select', textField: 'description', - valueField: 'code' + valueField: 'code', + sortable: true, }, waterQualityColour: { param: 'water_quality_colour', label: 'Water quality colour', type: 'select', textField: 'description', - valueField: 'code' + valueField: 'code', + sortable: true, }, waterQualityOdour: { param: 'water_quality_odour', label: 'Water quality odour', - type: 'text' + type: 'text', + sortable: true, }, ems: { param: 'ems', label: 'EMS Id', type: 'text', - anyValueBoolean: true + anyValueBoolean: true, + sortable: true, }, finalCasingStickUp: { param: 'final_casing_stick_up', label: 'Final casing stick up', - type: 'range' + type: 'range', + sortable: true, }, bedrockDepth: { param: 'bedrock_depth', label: 'Depth to bedrock', - type: 'range' + type: 'range', + sortable: true, }, staticWaterLevel: { param: 'static_water_level', label: 'Static water level', - type: 'range' + type: 'range', + sortable: true, }, wellYield: { param: 'well_yield', label: 'Estimated well yield', - type: 'range' + type: 'range', + sortable: true, }, artesianConditions: { param: 'artesian_conditions', label: 'Artesian Condition', type: 'radio', - options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }] + options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }], + sortable: true, + }, + wellCapType: { + param: 'well_cap_type', + label: 'Well cap type', + type: 'text', + sortable: true, }, - wellCapType: { param: 'well_cap_type', label: 'Well cap type', type: 'text' }, observationWellNumber: { param: 'observation_well_number', label: 'Observation well number', type: 'text', - anyValueBoolean: true + anyValueBoolean: true, + sortable: true, }, observationWellStatus: { param: 'observation_well_status', label: 'Observation well status', type: 'select', textField: 'description', - valueField: 'obs_well_status_code' + valueField: 'obs_well_status_code', + sortable: true, }, finishedWellDepth: { param: 'finished_well_depth', label: 'Finished well depth', resultLabel: 'Finished well depth (feet)', - type: 'range' + type: 'range', + sortable: true, }, decommissionReason: { param: 'decommission_reason', label: 'Reason for well decommission', - type: 'text' + type: 'text', + sortable: true, }, decommissionMethod: { param: 'decommission_method', label: 'Decommission method', type: 'select', textField: 'description', - valueField: 'decommission_method_code' + valueField: 'decommission_method_code', + sortable: true, }, decommissionSealantMaterial: { param: 'decommission_sealant_material', label: 'Sealant material', - type: 'text' + type: 'text', + sortable: true, }, decommissionBackfillMaterial: { param: 'decommission_backfill_material', label: 'Backfill material', - type: 'text' + type: 'text', + sortable: true, }, decommissionDetails: { param: 'decommission_details', label: 'Decommission details', - type: 'text' + type: 'text', + sortable: true, + }, + comments: { + param: 'comments', + label: 'Comments', + type: 'text', + sortable: true, }, - comments: { param: 'comments', label: 'Comments', type: 'text' }, alternativeSpecsSubmitted: { param: 'alternative_specs_submitted', label: 'Alt specs submitted', type: 'radio', - options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }] + options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }], + sortable: true, }, technicalReport: { param: 'technical_report', label: 'Technical Report', type: 'radio', - options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }] + options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }], + sortable: true, }, drinkingWaterProtectionArea: { param: 'drinking_water_protection_area_ind', label: 'Drinking Water Area Indicator', type: 'radio', - options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }] + options: [{ text: 'Yes', value: 'true' }, { text: 'No', value: 'false' }], + sortable: true, }, internalComments: { param: 'internal_comments', authenticated: true, label: 'Internal office comments', - type: 'text' + type: 'text', + sortable: true, }, aquiferLithology: { param: 'aquifer_lithology', label: 'Aquifer lithology', type: 'select', textField: 'description', - valueField: 'aquifer_lithology_code' + valueField: 'aquifer_lithology_code', + sortable: true, }, aquiferVulnerabilityIndex: { param: 'aquifer_vulnerability_index', label: 'AVI', - type: 'range' + type: 'range', + sortable: true, }, storativity: { param: 'storativity', label: 'Storativity', - type: 'range' + type: 'range', + sortable: true, }, startDatePumpingTest: { param: 'start_date_pumping_test', @@ -582,142 +718,167 @@ const SEARCH_FIELDS = { transmissivity: { param: 'transmissivity', label: 'Transmissivity', - type: 'range' + type: 'range', + sortable: true, }, hydraulicConductivity: { param: 'hydraulic_conductivity', label: 'Hydraulic Conductivity', - type: 'range' + type: 'range', + sortable: true, }, specificStorage: { param: 'specific_storage', label: 'Specific Storage', - type: 'text' + type: 'text', + sortable: true, }, specificYield: { param: 'specific_yield', label: 'Specific Yield', - type: 'range' + type: 'range', + sortable: true, }, specificCapacity: { param: 'specific_capacity', label: 'Specific Capacity', - type: 'range' + type: 'range', + sortable: true, }, pumpingTestDescription: { param: 'pumping_test_description', label: 'Pumping Test Description', type: 'select', textField: 'description', - valueField: 'pumping_test_description_code' + valueField: 'pumping_test_description_code', + sortable: true, }, createUser: { authenticated: true, param: 'create_user', label: 'Created by', - type: 'text' + type: 'text', + sortable: true, }, createDate: { authenticated: true, param: 'create_date', label: 'Created date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, updateUser: { authenticated: true, param: 'update_user', label: 'Updated by', - type: 'text' + type: 'text', + sortable: true, }, updateDate: { authenticated: true, param: 'update_date', label: 'Updated date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, wellTagNumber: { param: 'well_tag_number', label: 'Well tag number', - type: 'text' + type: 'text', + sortable: true, }, identificationPlateNumber: { param: 'identification_plate_number', label: 'ID plate number', - type: 'text' + type: 'text', + sortable: true, }, streetAddress: { param: 'street_address', label: 'Street Address', - type: 'text' + type: 'text', + sortable: true, }, legalLot: { param: 'legal_lot', label: 'Legal lot', resultLabel: 'Lot', - type: 'text' + type: 'text', + sortable: true, }, legalPlan: { param: 'legal_plan', label: 'Legal plan', resultLabel: 'Plan', - type: 'text' + type: 'text', + sortable: true, }, legalDistrictLot: { param: 'legal_district_lot', label: 'District lot', - type: 'text' + type: 'text', + sortable: true, }, legalPid: { param: 'legal_pid', label: 'PID', - type: 'text' + type: 'text', + sortable: true, }, diameter: { param: 'diameter', label: 'Diameter (inches)', - type: 'range' + type: 'range', + sortable: true, }, constructionStartDate: { param: 'construction_start_date', label: 'Construction start date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, constructionEndDate: { param: 'construction_end_date', label: 'Construction end date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, alterationStartDate: { param: 'alteration_start_date', label: 'Alteration start date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, alterationEndDate: { param: 'alteration_end_date', label: 'Alteration end date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, decomissionStartDate: { param: 'decomission_start_date', label: 'Decomission start date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, decomissionEndDate: { param: 'decomission_end_date', label: 'Decomission end date', - type: 'dateRange' + type: 'dateRange', + sortable: true, }, wellDisinfectedStatus: { param: 'well_disinfected_status', label: 'Well disinfected', type: 'select', textField: 'description', - valueField: 'well_disinfected_code' + valueField: 'well_disinfected_code', + sortable: true, } } export default { - data () { + data() { return { filterParams: {} // filterId: {param1: val, param2: val} } @@ -729,7 +890,7 @@ export default { 'organizationNames', 'userRoles' ]), - searchFields () { + searchFields() { const fields = { ...SEARCH_FIELDS } Object.keys(fields).forEach(k => { fields[k].sortParam = fields[k].sortParam || fields[k].param @@ -745,7 +906,7 @@ export default { return fields }, - landDistrictOptions () { + landDistrictOptions() { if (this.codes.land_district_codes === undefined || (this.codes.land_district_codes && Object.entries(this.codes.land_district_codes).length === 0)) { return [] } @@ -756,7 +917,7 @@ export default { } }) }, - wellSubclassOptions () { + wellSubclassOptions() { if (!this.codes.well_classes) { return [] } @@ -772,7 +933,7 @@ export default { return options }, - filterSelectOptions () { + filterSelectOptions() { const options = { aquiferLithology: this.codes.aquifer_lithology_codes || [], coordinateAcquisitionCode: this.codes.coordinate_acquisition_codes || [], @@ -817,14 +978,14 @@ export default { return options }, - searchQueryParams () { + searchQueryParams() { const searchQueryParams = Object.entries(this.filterParams).reduce((allParams, [id, filterParams]) => { return Object.assign(allParams, filterParams) }, {}) return searchQueryParams }, - emptyFilterParams () { + emptyFilterParams() { const filterParams = {} Object.keys(this.searchFields).forEach(id => { filterParams[id] = {} @@ -834,7 +995,7 @@ export default { } }, methods: { - getParamNames ({ param, type, anyValueBoolean }) { + getParamNames({ param, type, anyValueBoolean }) { const params = [] if (type === 'range') { params.push(`${param}_min`, `${param}_max`) @@ -850,14 +1011,14 @@ export default { return params }, - getFilterFields (fieldIds) { + getFilterFields(fieldIds) { return fieldIds.filter(id => this.searchFields[id] !== undefined).map(id => { const field = this.searchFields[id] const params = this.getParamNames(field) return { ...field, params: params, id: id } }) }, - clearFilterParams () { + clearFilterParams() { this.filterParams = { ...this.emptyFilterParams } } }