$(document).off('click', '.batch-btn').on('click', '.batch-btn', function()
{
    const type   = $(this).data('type');
    const dtable = zui.DTable.query($('#linkStoryList'));
    const checkedList = dtable.$.getChecks();
    if(!checkedList.length) return;

    const form = new FormData();
    checkedList.forEach((id) => form.append(type + 'IdList[]', id));

    $.ajaxSubmit({url: $(this).data('url'), data: form});
});

window.changeOption = function()
{
    const fromLane = $('[name=fromLane]').val();
    const toLane   = $('[name=toLane]').val();
    const url      = $.createLink('pi', 'linkstory', `piID=${piID}&columnID=${columnID}&from=${from}&fromLane=${fromLane}&toLane=${toLane}&browseType=${browseType}`);

    loadTarget(url, '.linkstory-modal-body');
}

window.changeRequirement = function()
{
    const requirementID = $('[name=requirement]').val();
    const url           = $.createLink('pi', 'linkstory', `piID=${piID}&columnID=${columnID}&from=team&fromLane=0&toLane=0&browseType=byrequirement&param=${requirementID}`);

    loadTarget(url, '.linkstory-modal-body');
}
