mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
New modal forms automatically work themselves out
This commit is contained in:
parent
047b9d1ecd
commit
291149d733
@ -6,13 +6,22 @@
|
|||||||
*/
|
*/
|
||||||
function createNewModal(options={}) {
|
function createNewModal(options={}) {
|
||||||
|
|
||||||
var id = options.id || 0;
|
|
||||||
|
|
||||||
// Always increment the ID of the modal
|
var id = 1;
|
||||||
id += 1;
|
|
||||||
|
// Check out what modal forms are already being displayed
|
||||||
|
$('.inventree-modal').each(function() {
|
||||||
|
var split = this.id.split('-');
|
||||||
|
console.log('existing form:', split);
|
||||||
|
var modal_id = parseInt(split[2]);
|
||||||
|
|
||||||
|
if (modal_id >= id) {
|
||||||
|
id = modal_id + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var html = `
|
var html = `
|
||||||
<div class='modal fade modal-fixed-footer modal-primary' role='dialog' id='modal-form-${id}'>
|
<div class='modal fade modal-fixed-footer modal-primary inventree-modal' role='dialog' id='modal-form-${id}'>
|
||||||
<div class='modal-dialog'>
|
<div class='modal-dialog'>
|
||||||
<div class='modal-content'>
|
<div class='modal-content'>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user