diff --git a/src/main/webapp/master/planos.html b/src/main/webapp/master/planos.html index 4ba8ea5..3f4b36d 100644 --- a/src/main/webapp/master/planos.html +++ b/src/main/webapp/master/planos.html @@ -1 +1 @@ -Planos

Planos

Novo plano

Planos cadastrados

IDNomeValorDescricaoStatus
\ No newline at end of file +Planos

Planos

Novo plano

Planos cadastrados

IDNomeValorDescricaoStatus
\ No newline at end of file diff --git a/src/main/webapp/master/planos.js b/src/main/webapp/master/planos.js index 6c5043e..45ef09e 100644 --- a/src/main/webapp/master/planos.js +++ b/src/main/webapp/master/planos.js @@ -1 +1 @@ -const form=document.querySelector('#plano-form'),rows=document.querySelector('#rows');async function load(){try{const d=await Api.get('/api/master/planos');rows.innerHTML=(d.planos||[]).map(p=>`${p.id}${p.nome}${Util.money(p.valor_mensal_centavos)}${p.descricao||''}${Util.badge(p.ativo?'ativo':'inativo')}`).join('')}catch(e){Util.toast(e.message,true)}}form.onsubmit=async e=>{e.preventDefault();const b=Util.formData(form);b.funcionalidades=(b.funcionalidades||'').split(',').map(x=>x.trim()).filter(Boolean);try{await Api.post('/api/master/planos',b);form.reset();Util.toast('Plano salvo');load()}catch(err){Util.toast(err.message,true)}};load(); \ No newline at end of file +const form=document.querySelector('#plano-form'),rows=document.querySelector('#rows');async function load(){try{const d=await Api.get('/api/master/planos');rows.innerHTML=(d.planos||[]).map(p=>`${p.id}${p.nome}${Util.money(p.valor_mensal_centavos)}${p.descricao||''}${Util.badge(p.ativo?'ativo':'inativo')}`).join('')}catch(e){Util.toast(e.message,true)}}form.onsubmit=async e=>{e.preventDefault();const b=Util.formData(form);b.funcionalidades=[];try{await Api.post('/api/master/planos',b);form.reset();Util.toast('Plano salvo');load()}catch(err){Util.toast(err.message,true)}};load(); \ No newline at end of file