{% extends "corptools/character/char_base.html" %}
{% block ct_block %}
    <form class="text-center">
        <select name="location" class="form-control asset_location">
            {% for id, option in asset_locations.items %}<option value="{{ id }}">{{ option }}</option>{% endfor %}
        </select>
    </form>
</br />
<div class="row flex-container flex-wrap" id="asset_content"></div>

{% endblock ct_block %}
{% block ct_extra_script %}

    $(".asset_location").change(function() {
    var selectedValue = $(this).val();
    get_assets(selectedValue)
    });

    function get_assets(location_id){
    var url = "{% url 'corptools:assets_lists' main_char.character_id 123456 %}";
    url = url.replace('123456', location_id);
    $.get(url, function(data) {
    asset_body = $("#asset_content")[0];
    asset_body.innerHTML = data;
    });
    }

    $(document).ready(function() {
    get_assets(0)
    }
    )
{% endblock ct_extra_script %}
