function addressShow(elem)
{
    let type = $(elem).attr('type-id')
    $.ajax
    ({
        url : url_addresses,
        type: 'GET',
        data: 'type='+type,
        success:function(data)
        {
            $('#addresses').html(data)
        }
    })
}

function addressForm(elem)
{
    let action = $(elem).attr('action-id')
    $.ajax
    ({
        url : action,
        type: 'GET',
        data: '',
        success:function(data)
        {
            $('#address_form').html(data)
        }
    })
}

function deleteAddress(elem)
{
    let url = $(elem).attr('action-id');
    $.ajax({
        url : url,
        type: 'DELETE',
        data: {
            "_token": $('meta[name="csrf-token"]').attr('content'),
        }
    })
    $(elem).closest('.loc_card').hide(1000)
    setTimeout(
        function()
        {
            $('#v-pills-tab3-tab').click()
        }, 1100);
}

if ($("#newLocForm").length)
{
    $("#newLocForm").hide();
    $('input[type="radio"][name="address_id"]').click(function () {
        if ($(this).attr("value") == "") {
            $("#newLocForm").show();
        } else {
            $("#newLocForm").hide();
        }
    });
}
