* Added drop down menus to collections to select if games should be always included * Now able to add games to a collection from the game info page
74 lines
2.4 KiB
HTML
74 lines
2.4 KiB
HTML
<p>
|
|
Select collection to add game to:
|
|
</p>
|
|
|
|
<table style="width: 100%;">
|
|
<tr>
|
|
<td colspan="2">
|
|
<select id="collection_addgame" style="width: 100%;"></select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="padding-top: 15px;">
|
|
<input type="checkbox" id="collection_rebuild" style="margin-right: 5px;" /><label for="collection_rebuild">Rebuild Collection</label>
|
|
</td>
|
|
<td style="text-align: right; padding-top: 15px;">
|
|
<button id="collection_cancelbtn" value="Cancel" onclick="closeSubDialog();">Cancel</button>
|
|
<button id="collection_addbtn" value="Add" onclick="AddToCollection();">Add</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<script type="text/javascript">
|
|
document.getElementById('collection_addgame').innerHTML = "<option value='0' selected='selected'>Select collection</option>";
|
|
|
|
$('#collection_addgame').select2({
|
|
ajax: {
|
|
url: '/api/v1/Collections',
|
|
placeholder: 'Select collection',
|
|
processResults: function (data) {
|
|
var arr = [];
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
arr.push({
|
|
id: data[i].id,
|
|
text: data[i].name
|
|
});
|
|
}
|
|
|
|
return {
|
|
results: arr
|
|
};
|
|
}
|
|
}
|
|
});
|
|
|
|
function AddToCollection() {
|
|
var CollectionId = Number(document.getElementById('collection_addgame').value);
|
|
var PlatformId = modalVariables;
|
|
var GameId = getQueryString('id', 'int');
|
|
var RebuildCollection = '';
|
|
if (document.getElementById('collection_rebuild').checked == true) {
|
|
RebuildCollection = '?Rebuild=true';
|
|
}
|
|
var responseBody = {
|
|
"PlatformId": PlatformId,
|
|
"GameId": GameId,
|
|
"InclusionState": "AlwaysInclude"
|
|
};
|
|
|
|
if (CollectionId != 0) {
|
|
ajaxCall(
|
|
'/api/v1/Collections/' + CollectionId + '/AlwaysInclude' + RebuildCollection,
|
|
'PATCH',
|
|
function (result) {
|
|
closeSubDialog();
|
|
},
|
|
function (error) {
|
|
console.log(JSON.stringify(error));
|
|
},
|
|
JSON.stringify(responseBody)
|
|
);
|
|
}
|
|
}
|
|
</script> |