|
|
@@ -436,10 +436,10 @@ $tab_l2 = '<form method="post" action="'.$save.'" id="wc-l2-form">'
|
|
|
.'<div class="wc-grid">'.$collectCard.$displayCard.$networkCard.$coreCard.$colorCard.$latCard.$groupCard.'</div>'
|
|
|
.'<div class="wc-actions" style="margin-top:18px"><button class="wc-btn wc-btn--primary" type="submit">'.$t('btn.save').'</button></div>'
|
|
|
.'</form>'
|
|
|
- .'<script>(function(){function wire(addId,boxId,tplId){var add=document.getElementById(addId),box=document.getElementById(boxId),tpl=document.getElementById(tplId);'
|
|
|
+ .'<script>(function(){function wire(addId,boxId,tplId,allowEmpty){var add=document.getElementById(addId),box=document.getElementById(boxId),tpl=document.getElementById(tplId);'
|
|
|
.'if(add&&box&&tpl){add.addEventListener("click",function(){var w=document.createElement("div");w.innerHTML=tpl.innerHTML.trim();box.appendChild(w.firstChild);});}'
|
|
|
- .'if(box){box.addEventListener("click",function(ev){if(ev.target.classList.contains("wc-rule-del")){var r=ev.target.closest(".wc-rule");if(r&&box.querySelectorAll(".wc-rule").length>1){r.remove();}}});}}'
|
|
|
- .'wire("wc-rule-add","wc-rules","wc-rule-tpl");wire("wc-core-add","wc-cores","wc-core-tpl");'
|
|
|
+ .'if(box){box.addEventListener("click",function(ev){if(ev.target.classList.contains("wc-rule-del")){var r=ev.target.closest(".wc-rule");if(r&&(allowEmpty||box.querySelectorAll(".wc-rule").length>1)){r.remove();}}});}}'
|
|
|
+ .'wire("wc-rule-add","wc-rules","wc-rule-tpl",false);wire("wc-core-add","wc-cores","wc-core-tpl",true);'
|
|
|
.'})();</script>';
|
|
|
|
|
|
/* ============================ assemble =============================== */
|