function changeButton(id,info){
if (id === 'duty-button') {
$(`#${id}`).html(($(`#${id}`).html() === "Select") ? "<i class='bi bi-patch-check'></i>" : "Select")
$.post('https://qb-multijob/toggleDuty');
} else if (id == 'delete-button') {
$(`#${info}`).parent().parent().remove();
if ($(`.jobs`).children().length === 0) {
$('.jobs').html('<h3 style="margin: auto;">You have no jobs</h3>');
}
$.post('https://qb-multijob/deleteJob', JSON.stringify({
job: info.toString()
}));
} else {
$('#duty-button').html("Select")
$('.job-selectButton').each(function(index) {
$(this).replaceWith(`<button class="button job-selectButton" id="${$(this).attr('id')}" data-grade="${$(this).data('grade')}">Select</button>`)
})
$(`#${id}`).replaceWith( `
<div class="job-selectButton" id="${id}" data-grade="${info}">
<button class="half-button" id="delete-button" data-name="${id}" >
<i class='bi bi-trash'></i>
</button>
<button class="half-button">
<i class='bi bi-patch-check'></i>
</button>
</div>
`)
$.post('https://qb-multijob/changeJob', JSON.stringify({
job: id.toString(),
grade: info.toString()
}));
}
}