1.1.3 rising and highlight my_route
This commit is contained in:
@@ -616,18 +616,24 @@ function confirmUpgrade(el, routeID){
|
||||
event.preventDefault()
|
||||
el.disabled = true
|
||||
|
||||
let remainsRisingCount = parseInt(document.getElementById('remains_route_rising_count').innerText);
|
||||
let remainsHighlightCount = parseInt(document.getElementById('remains_route_highlight_count').innerText);
|
||||
|
||||
let form = el.form
|
||||
let formData = new FormData(form);
|
||||
formData.set('route_id', routeID)
|
||||
formData.set('remainsRisingCount', remainsRisingCount)
|
||||
formData.set('remainsHighlightCount', remainsHighlightCount)
|
||||
let url = '/routes/'
|
||||
let checkboxes = document.querySelectorAll('input[name="route_option"]');
|
||||
// let checkboxes = document.querySelectorAll('input[name="route_option"]');
|
||||
let checkboxes = document.querySelectorAll('input[name="route_option"][data-routeid="' + routeID + '"]');
|
||||
|
||||
|
||||
for (let i = 0; i < checkboxes.length; i++) {
|
||||
|
||||
if (checkboxes[i].checked && checkboxes[i].id === "highlight_route" ) {
|
||||
if (checkboxes[i].checked && checkboxes[i].id === "highlight_route_" + routeID ) {
|
||||
url = '/routes/highlight_route/'
|
||||
}else if(checkboxes[i].checked && checkboxes[i].id === "raise_route"){
|
||||
}else if(checkboxes[i].checked && checkboxes[i].id === "raise_route_" + routeID){
|
||||
url = '/routes/raise_route/'
|
||||
}
|
||||
}
|
||||
@@ -645,10 +651,31 @@ function confirmUpgrade(el, routeID){
|
||||
data: formData,
|
||||
success: function(data){
|
||||
|
||||
if(url === '/routes/raise_route/' && remainsRisingCount > 0 ){
|
||||
remainsRisingCount -= 1;
|
||||
} else if(url === '/routes/highlight_route/' && remainsHighlightCount > 0){
|
||||
remainsHighlightCount -= 1;
|
||||
}
|
||||
|
||||
|
||||
// for (let i = 0; i < checkboxes.length; i++) {
|
||||
//
|
||||
// if (checkboxes[i].checked && remainsRisingCount > 0 ) {
|
||||
// remainsRisingCount -= 1;
|
||||
// }else if(checkboxes[i].checked && remainsHighlightCount > 0){
|
||||
// remainsHighlightCount -= 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
document.getElementById('remains_route_rising_count').innerText = remainsRisingCount.toString();
|
||||
document.getElementById('remains_route_highlight_count').innerText = remainsHighlightCount;
|
||||
|
||||
let data_route_id = data.route_id
|
||||
// location.href = '/profile'
|
||||
// document.querySelector(".info_profile").innerHTML = data.html
|
||||
|
||||
if(!data.status){
|
||||
document.querySelector('[data-number-of-route="' + routeID + '"]').innerHTML = data.html
|
||||
}
|
||||
|
||||
|
||||
let el_route = document.querySelector(`[data-number-of-route="${data_route_id}"]`);
|
||||
|
||||
Reference in New Issue
Block a user