// import {MDCDialog} from '@material/dialog'; import {MDCSelect} from '@material/select'; import {MDCTextField} from '@material/textfield'; import {MDCTextFieldHelperText} from '@material/textfield/helper-text'; // const dialog = new MDCDialog(document.querySelector('.mdc-dialog')); // const semCloneSelect = new MDCSelect(document.querySelector('.mdc-select#sem-clone-select')); // const textfield = new MDCTextField(document.querySelector('.mdc-text-field')); $(document).ready( function() { $('#modal-semester').on('show.bs.modal', function (event) { var form = $(this).find('#modal-semester-form'); form.attr('method', 'GET'); form.removeAttr('action'); var button = $(event.relatedTarget); var action = button.data('action'); const semSelect = new MDCSelect($(this).find('#sem-select')[0]); if (semSelect.value !== '') { form.attr('method', 'POST'); form.attr('action', `/dashboard/${action}/${semSelect.value}`); } semSelect.listen('MDCSelect:change', () => { if (semSelect.value !== '') { form.attr('method', 'POST'); form.attr('action', `/dashboard/${action}/${semSelect.value}`); } }); }); $('#modal-semester-clone').on('show.bs.modal', function (event) { var form = $(this).find('#modal-semester-clone-form'); var button = $(event.relatedTarget); var action = button.data('action'); console.log($(this)); const semCloneSelect = new MDCSelect($(this).find('#sem-clone-select')[0]); // console.log(textfields); // const t1 = new MDCTextField(document.querySelector('.mdc-text-field')); form.attr('method', 'GET'); form.removeAttr('action'); if (semCloneSelect.value !== '') { form.attr('method', 'POST'); form.attr('action', `/dashboard/clone/${semCloneSelect.value}`); } semCloneSelect.listen('MDCSelect:change', () => { if (semCloneSelect.value !== '') { form.attr('method', 'POST'); form.attr('action', `/dashboard/clone/${semCloneSelect.value}`); } }); }); });