ResMan update

This commit is contained in:
ecki
2026-03-09 17:31:29 +01:00
parent 2757db3268
commit 6a8f26f60d
2 changed files with 24 additions and 16 deletions
+7 -9
View File
@@ -602,7 +602,7 @@ document.querySelectorAll("#resourceModal input, #resourceModal textarea")
.forEach(e=>e.value="")
document.getElementById("resourceModal").style.display="block"
document.getElementById("status").value="aktiv"
}
@@ -823,19 +823,17 @@ document.getElementById("domainModal").style.display="none"
}
async function saveDomain(){
const id=document.getElementById("domain_id").value
const data={
domain_name:domain_name.value,
provider:domain_provider.value,
ip_address:domain_ip.value,
yearly_cost:domain_cost.value,
notes:domain_notes.value
domain_name:document.getElementById("domain_name").value,
provider:document.getElementById("domain_provider").value,
ip_address:document.getElementById("domain_ip").value,
yearly_cost:document.getElementById("domain_cost").value || null,
notes:document.getElementById("domain_notes").value
}
@@ -861,11 +859,11 @@ closeDomainModal()
loadDomains()
loadMapping()
loadCosts()
}
async function deleteDomain(id){
await fetch(API+"/domains/"+id,{method:"DELETE"})
+17 -7
View File
@@ -54,14 +54,24 @@ router.get('/:id', async (req, res) => {
// CREATE DOMAIN
router.post('/', async (req, res) => {
try {
const { domain_name, provider, ip_address, yearly_cost, notes } = req.body;
const [result] = await pool.query(
`INSERT INTO domains
(domain_name, provider, ip_address, yearly_cost, notes)
VALUES (?, ?, ?, ?, ?)`,
[domain_name, provider, ip_address, yearly_cost, notes]
);
const { domain_name, provider, ip_address, yearly_cost, notes } = req.body;
await pool.query(
`INSERT INTO domains
(domain_name, provider, ip_address, yearly_cost, notes)
VALUES (?, ?, ?, ?, ?)`,
[
domain_name,
provider,
ip_address,
yearly_cost || null,
notes
]
);
res.json({
message: "Domain created",