<commit_before>{% extends 'gwells/base.html' %}
{% load crispy_forms_tags pagination_tags sorting_tags %}

{% block title %}Search{% endblock %}

{% block bodyheading_block %}Search{% endblock %}

{% block introduction_block %}
    <ul>
        <li>Search by well tag or well ID plate number (if known) for the most precise results</li>
        <li>If not known, try searching with one or more additional fields</li>
        <li>Use <a href="#">Advanced Search</a> for additional search options</li>
    </ul>
    <br />
{% endblock %}

{% block body_block %}

<div class="row">
    <div class="col-sm-4">
        {% crispy form %}         
    </div>
    <div class="col-md-8">
        <div class="row">
            <button id="identify-wells-btn" class="btn btn-primary" type="button" onclick="startIdentifyWellsOperation()">Select Area on Map</button>
        </div>
        <div class="row">
            <div id="search-map" class="col-md-6"></div>
        </div>
    </div>
 </div>
<br />
{% if too_many_wells %}
    <div class="alert alert-danger">{{ too_many_wells }}</div>
{% elif well_list %}
    <!-- Removed because the query is sorted and sliced in search.py { autosort well_list }-->
    <div id="wells-json" data-wells-search-json="{{wells_json}}"></div>
    {% autopaginate well_list 25 %}
        <div class="row">
            <div class="col-sm-12">
                {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} results
                <br /><br />
            </div>
        </div>

        <div class="row row-header">
            <div class="col-sm-1">
                {% anchor well_tag_number "Well Tag #" %}
            </div>
            <div class="col-sm-1">
                {% anchor identification_plate_number "Well ID Plate #" %}
            </div>
            <div class="col-sm-2">
                {% anchor owner_full_name "Owner Name" %}
            </div>
            <div class="col-sm-1">
                {% anchor street_address "Street Address" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_lot "Lot" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_plan "Plan" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_district_lot "District Lot" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_land_district "Land District" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_pid "PID" %}
            </div>
            <div class="col-sm-1">
                {% anchor diameter "Diameter (in)" %}
            </div>
            <div class="col-sm-1">
                {% anchor finished_well_depth "Finished Well Depth (ft)" %}
            </div>
        </div>

    {% for well in well_list %}
        <div class="row row-bordered">
            <div class="col-sm-1">
                <a href="{% url 'well_detail' well.well_tag_number %}">{{ well.well_tag_number }}</a>
            </div>
            <div class="col-sm-1">
                {{ well.identification_plate_number|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-2">
                {{ well.owner_full_name|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.street_address|default_if_none:'' }}
                {{ well.city|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_lot|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_plan|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_district_lot|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_land_district.name|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_pid|stringformat:"09d"|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.diameter|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.finished_well_depth|default_if_none:'&nbsp;' }}
            </div>
        </div>
    {% endfor %}

    <div class="row">
        {% paginate using 'gwells/bootstrap_pagination.html' %}
    </div>
     
        	
{% elif 'well' in request.GET %}
    <div class="row">
        <div class="col-sm-12">
            <em>No well records could be found.</em>
        </div>
    </div>

{% endif %}

        <br />
{% if 'well' in request.GET %}
    <p>
        Can’t find the well you are looking for? Try your search again using a different set of criteria. If you still need more assistance, Contact <a href="https://portal.nrs.gov.bc.ca/web/client/contact">FrontCounterBC</a>.
    </p>
{% endif %}

        <p>
            We may not have a copy of your well record. Until February 29, 2016, it was voluntary for well drillers to submit well records to the Province. 
            Issues related to data quality may make finding your well record difficult.
        </p>


{% endblock %}

{% block jqscript_block %}
<script>
    // The search page has a map.
    var searchMap = null;
    // Options for creating the searchMap
    var searchMapOptions = {
        // The ID of the addMap div.
        mapNodeId: 'search-map',
        // Minimum zoom level of the map (i.e., how far it can be zoomed out)
        minZoom: 4,
        // Maximum zoom of the map (i.e., how far it can be zoomed in)
        maxZoom: 17,
        // Bounding lats and longs of the map, corresponding to the lat/long extremes of BC.
        mapBounds: {
            north:  60.0223,
            south: 48.2045556,
            west: -139.0736706,
            east: -114.0338224,
            padding: 5 // Margin beyond extremes to pad the bounds with, as a percentage of the total bounding box.
        },
        // ESRI layers associated with the map
        esriLayers: [
            {
                url: 'http://maps.gov.bc.ca/arcserver/rest/services/Province/roads_wm/MapServer'
            }
        ],
        // WMS layers associated with the map
        wmsLayers: [
            {
                rootUrl: 'https://openmaps.gov.bc.ca/geo/pub/WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW/ows?',
                format: 'image/png',
                layers: 'pub:WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW',
                styles: 'PMBC_Parcel_Fabric_Cadastre_Outlined',
                transparent: true
            }        
        ],
        identifyWellsStartCallback: identifyWellsStartCallback, 
        identifyWellsEndCallback: identifyWellsEndCallback    
    };

    // Hard-coded names for the hidden lat-long fields that delineate a
    // rectangle drawn by the user as part of an identifyWells operation.
    var startLatLongFieldName = "start_lat_long";
    var endLatLongFieldName = "end_lat_long";

    function startIdentifyWellsOperation() {
        if (searchMap !== null) {
            searchMap.startIdentifyWells();
        }
    }

    // We want to alter the map to have crosshairs during identifyWells,
    // as well as disabling the button until the operation is over.
    // TODO: Style button, hide on operation init?
    function identifyWellsStartCallback() {
        $("#search-map").addClass('identify-wells-operation');
        $("#identify-wells-btn").prop("disabled", true);
    }

    // Remove the crosshairs from the map, re-enable the button, gather
    // the corners of the rectangle, and submit the form.
    function identifyWellsEndCallback(startLatLong, endLatLong) {
        $("#search-map").removeClass('identify-wells-operation');
        $("#identify-wells-btn").prop("disabled", false);
        var startLatLongString = startLatLong.lat + ',' + startLatLong.lng;
        var endLatLongString = endLatLong.lat + ',' + endLatLong.lng;
        $("[name="+startLatLongFieldName+"]").val(startLatLongString);
        $("[name="+endLatLongFieldName+"]").val(endLatLongString);
        $("#id-searchForm").submit();
    }

    $(document).ready(function(){
        $('[data-toggle="popover"]').popover({'trigger':'hover'});
        searchMap = new WellsMap(searchMapOptions);
        // TODO: Tag the data-containing div with an id and fetch it with $("#data-id").data("wells-search-json")?
        var wellsJson = $("#wells-json").attr("data-wells-search-json") || null;
        var wells = JSON.parse(wellsJson);
        searchMap.drawAndZoom(wells);            
    });
</script>
{% endblock %}<commit_msg>Changed map size and button styling.<commit_after>{% extends 'gwells/base.html' %}
{% load crispy_forms_tags pagination_tags sorting_tags %}

{% block title %}Search{% endblock %}

{% block bodyheading_block %}Search{% endblock %}

{% block introduction_block %}
    <ul>
        <li>Search by well tag or well ID plate number (if known) for the most precise results</li>
        <li>If not known, try searching with one or more additional fields</li>
        <li>Use <a href="#">Advanced Search</a> for additional search options</li>
    </ul>
    <br />
{% endblock %}

{% block body_block %}

<div class="row">
    <div class="col-sm-4">
        {% crispy form %}         
    </div>
    <div class="col-md-8">
        <div class="row">
            <button id="identify-wells-btn" class="btn btn-default" type="button" onclick="startIdentifyWellsOperation()">Select Area on Map</button>
        </div>
        <div class="row">
            <div id="search-map" class="col-md-7"></div>
        </div>
    </div>
 </div>
<br />
{% if too_many_wells %}
    <div class="alert alert-danger">{{ too_many_wells }}</div>
{% elif well_list %}
    <!-- Removed because the query is sorted and sliced in search.py { autosort well_list }-->
    <div id="wells-json" data-wells-search-json="{{wells_json}}"></div>
    {% autopaginate well_list 25 %}
        <div class="row">
            <div class="col-sm-12">
                {{ page_obj.start_index }}-{{ page_obj.end_index }} of {{ page_obj.paginator.count }} results
                <br /><br />
            </div>
        </div>

        <div class="row row-header">
            <div class="col-sm-1">
                {% anchor well_tag_number "Well Tag #" %}
            </div>
            <div class="col-sm-1">
                {% anchor identification_plate_number "Well ID Plate #" %}
            </div>
            <div class="col-sm-2">
                {% anchor owner_full_name "Owner Name" %}
            </div>
            <div class="col-sm-1">
                {% anchor street_address "Street Address" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_lot "Lot" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_plan "Plan" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_district_lot "District Lot" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_land_district "Land District" %}
            </div>
            <div class="col-sm-1">
                {% anchor legal_pid "PID" %}
            </div>
            <div class="col-sm-1">
                {% anchor diameter "Diameter (in)" %}
            </div>
            <div class="col-sm-1">
                {% anchor finished_well_depth "Finished Well Depth (ft)" %}
            </div>
        </div>

    {% for well in well_list %}
        <div class="row row-bordered">
            <div class="col-sm-1">
                <a href="{% url 'well_detail' well.well_tag_number %}">{{ well.well_tag_number }}</a>
            </div>
            <div class="col-sm-1">
                {{ well.identification_plate_number|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-2">
                {{ well.owner_full_name|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.street_address|default_if_none:'' }}
                {{ well.city|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_lot|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_plan|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_district_lot|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_land_district.name|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.legal_pid|stringformat:"09d"|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.diameter|default_if_none:'&nbsp;' }}
            </div>
            <div class="col-sm-1">
                {{ well.finished_well_depth|default_if_none:'&nbsp;' }}
            </div>
        </div>
    {% endfor %}

    <div class="row">
        {% paginate using 'gwells/bootstrap_pagination.html' %}
    </div>
     
        	
{% elif 'well' in request.GET %}
    <div class="row">
        <div class="col-sm-12">
            <em>No well records could be found.</em>
        </div>
    </div>

{% endif %}

        <br />
{% if 'well' in request.GET %}
    <p>
        Can’t find the well you are looking for? Try your search again using a different set of criteria. If you still need more assistance, Contact <a href="https://portal.nrs.gov.bc.ca/web/client/contact">FrontCounterBC</a>.
    </p>
{% endif %}

        <p>
            We may not have a copy of your well record. Until February 29, 2016, it was voluntary for well drillers to submit well records to the Province. 
            Issues related to data quality may make finding your well record difficult.
        </p>


{% endblock %}

{% block jqscript_block %}
<script>
    // The search page has a map.
    var searchMap = null;
    // Options for creating the searchMap
    var searchMapOptions = {
        // The ID of the addMap div.
        mapNodeId: 'search-map',
        // Minimum zoom level of the map (i.e., how far it can be zoomed out)
        minZoom: 4,
        // Maximum zoom of the map (i.e., how far it can be zoomed in)
        maxZoom: 17,
        // Bounding lats and longs of the map, corresponding to the lat/long extremes of BC.
        mapBounds: {
            north:  60.0223,
            south: 48.2045556,
            west: -139.0736706,
            east: -114.0338224,
            padding: 5 // Margin beyond extremes to pad the bounds with, as a percentage of the total bounding box.
        },
        // ESRI layers associated with the map
        esriLayers: [
            {
                url: 'http://maps.gov.bc.ca/arcserver/rest/services/Province/roads_wm/MapServer'
            }
        ],
        // WMS layers associated with the map
        wmsLayers: [
            {
                rootUrl: 'https://openmaps.gov.bc.ca/geo/pub/WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW/ows?',
                format: 'image/png',
                layers: 'pub:WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW',
                styles: 'PMBC_Parcel_Fabric_Cadastre_Outlined',
                transparent: true
            }        
        ],
        identifyWellsStartCallback: identifyWellsStartCallback, 
        identifyWellsEndCallback: identifyWellsEndCallback    
    };

    // Hard-coded names for the hidden lat-long fields that delineate a
    // rectangle drawn by the user as part of an identifyWells operation.
    var startLatLongFieldName = "start_lat_long";
    var endLatLongFieldName = "end_lat_long";

    function startIdentifyWellsOperation() {
        if (searchMap !== null) {
            searchMap.startIdentifyWells();
        }
    }

    // We want to alter the map to have crosshairs during identifyWells,
    // as well as disabling the button until the operation is over.
    // TODO: Style button, hide on operation init?
    function identifyWellsStartCallback() {
        $("#search-map").addClass('identify-wells-operation');
        $("#identify-wells-btn").prop("disabled", true);
    }

    // Remove the crosshairs from the map, re-enable the button, gather
    // the corners of the rectangle, and submit the form.
    function identifyWellsEndCallback(startLatLong, endLatLong) {
        $("#search-map").removeClass('identify-wells-operation');
        $("#identify-wells-btn").prop("disabled", false);
        var startLatLongString = startLatLong.lat + ',' + startLatLong.lng;
        var endLatLongString = endLatLong.lat + ',' + endLatLong.lng;
        $("[name="+startLatLongFieldName+"]").val(startLatLongString);
        $("[name="+endLatLongFieldName+"]").val(endLatLongString);
        $("#id-searchForm").submit();
    }

    $(document).ready(function(){
        $('[data-toggle="popover"]').popover({'trigger':'hover'});
        searchMap = new WellsMap(searchMapOptions);
        // TODO: Tag the data-containing div with an id and fetch it with $("#data-id").data("wells-search-json")?
        var wellsJson = $("#wells-json").attr("data-wells-search-json") || null;
        var wells = JSON.parse(wellsJson);
        searchMap.drawAndZoom(wells);            
    });
</script>
{% endblock %}
{'fraction_non_alphanumeric': 0.1417606964889169, 'fraction_numerical': 0.008935219657483246, 'mean_word_length': 1.9379101463907118, 'pattern_counts': {'":': 0, '<': 211, '<?xml version=': 0, '>': 211, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1668971', 'n_tokens_mistral': 5543, 'n_tokens_neox': 5173, 'n_words': 1263}