<%inherit file="dialog.tpl"/>

<%block name="blkDialogId">diaNetworkDelete</%block>

<%block name="blkDialogHeader">
  Deleting from Verge3D Network...
</%block>

<%block name="blkDialogContent">
  <div class="spinner-preloader-cont">
    <div class="spinner-preloader"></div>
    <div class="dialog-text-creating-native-app">Deleting files...</div>
  </div>
</%block>

<%block name="blkDialogScript">
    ${parent.blkDialogScript()}

    diaNetworkDelete.addEventListener('dialogopen', function() {
        const checkers = document.getElementsByClassName('netcheckbox');

        const deleteKeys = [];

        for (let i = 0; i < checkers.length; i++) {
            const checker = checkers[i];

            if (checker.checked)
                deleteKeys.push(checker.value);
        }

        const url = '/network/delete?key=' + deleteKeys.join('&key=');

        makeRequest(url, null, function(response) {
            closeDialog('diaNetworkDelete');

            const dia = appendDialog(response);
            openDialog(dia);
        });
    });
</%block>
