add new block dialog to scheduler
This commit is contained in:
parent
b0c35eaa6d
commit
285180957a
97
layout.html
97
layout.html
@ -400,40 +400,40 @@
|
|||||||
// show dialog to get media metadata for new upload
|
// show dialog to get media metadata for new upload
|
||||||
console.log("Upload response: ");
|
console.log("Upload response: ");
|
||||||
console.dir(json);
|
console.dir(json);
|
||||||
const metadata_dialog = document.getElementById("media_details_dialog");
|
const metadata_dialog = document.getElementById("media_details_dialog");
|
||||||
const metadata_header = document.getElementById("media_details_dialog_header");
|
const metadata_header = document.getElementById("media_details_dialog_header");
|
||||||
metadata_header.innerHTML = "Metadata for " + json.source_path;
|
metadata_header.innerHTML = "Metadata for " + json.source_path;
|
||||||
const metadata_title = document.getElementById("media_details_dialog_title");
|
const metadata_title = document.getElementById("media_details_dialog_title");
|
||||||
metadata_title.value = json.title === "unknown" ? json.source_path : json.title;
|
metadata_title.value = json.title === "unknown" ? json.source_path : json.title;
|
||||||
const dur_span = document.getElementById("media_details_dialog_duration_secs");
|
const dur_span = document.getElementById("media_details_dialog_duration_secs");
|
||||||
dur_span.innerHTML = new Date(json.duration_secs * 1000).toISOString().substring(11, 19);
|
dur_span.innerHTML = new Date(json.duration_secs * 1000).toISOString().substring(11, 19);
|
||||||
const id_input = document.getElementById("media_details_dialog_id");
|
const id_input = document.getElementById("media_details_dialog_id");
|
||||||
id_input.value = json.id;
|
id_input.value = json.id;
|
||||||
const metadata_close_button = document.getElementById("media_details_dialog_close_button");
|
const metadata_close_button = document.getElementById("media_details_dialog_close_button");
|
||||||
metadata_close_button.addEventListener("click", (event) => {
|
metadata_close_button.addEventListener("click", (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
metadata_dialog.close();
|
metadata_dialog.close();
|
||||||
});
|
});
|
||||||
const metadata_save_button = document.getElementById("media_details_dialog_save_button");
|
const metadata_save_button = document.getElementById("media_details_dialog_save_button");
|
||||||
metadata_save_button.addEventListener("click", (event) => {
|
metadata_save_button.addEventListener("click", (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const updateURL = "update.php?id=" + json.id;
|
const updateURL = "update.php?id=" + json.id;
|
||||||
let data = new FormData(document.getElementById("media_details_dialog_form"));
|
let data = new FormData(document.getElementById("media_details_dialog_form"));
|
||||||
console.dir(data);
|
console.dir(data);
|
||||||
fetch(updateURL, {
|
fetch(updateURL, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: data
|
body: data
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
response.json().then((json) => {
|
response.json().then((json) => {
|
||||||
metadata_dialog.close();
|
metadata_dialog.close();
|
||||||
fetch_media_items();
|
fetch_media_items();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
metadata_dialog.showModal();
|
metadata_dialog.showModal();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -816,7 +816,36 @@
|
|||||||
const schedule_grid_click_handler = (e) => {
|
const schedule_grid_click_handler = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// TODO: open dialog for add block
|
// TODO: open dialog for add block
|
||||||
|
const new_block_dialog = document.getElementById("new_block_dialog");
|
||||||
|
const new_block_header = document.getElementById("new_block_dialog_header");
|
||||||
|
const block_start_time = e.target.parentNode.firstElementChild.innerHTML;
|
||||||
|
new_block_header.innerHTML = "New program block for " + block_start_time;
|
||||||
|
|
||||||
|
const new_block_close_button = document.getElementById("new_block_dialog_close_button");
|
||||||
|
new_block_close_button.addEventListener("click", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
new_block_dialog.close();
|
||||||
|
});
|
||||||
|
const new_block_save_button = document.getElementById("new_block_dialog_save_button");
|
||||||
|
new_block_save_button.addEventListener("click", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const updateURL = "block.php";
|
||||||
|
let data = new FormData(document.getElementById("new_block_dialog_form"));
|
||||||
|
console.dir(data);
|
||||||
|
fetch(updateURL, {
|
||||||
|
method: "POST",
|
||||||
|
body: data
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
response.json().then((json) => {
|
||||||
|
new_block_dialog.close();
|
||||||
|
load_schedule(); // TODO: need to pass day here to keep working on the same schedule!
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
new_block_dialog.showModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
const schedule_block_click_handler = (e) => {
|
const schedule_block_click_handler = (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user