mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-04-25 01:37:17 +00:00
258 lines
11 KiB
HTML
258 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>FFXIV loot helper</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<link href="/static/favicon.ico" rel="shortcut icon">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous" type="text/css">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet" type="text/css">
|
|
|
|
<link href="https://unpkg.com/bootstrap-table@1.19.1/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css">
|
|
|
|
|
|
<link href="https://unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.css" rel="stylesheet" type="text/css">
|
|
|
|
<link href="/static/styles.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
<nav class="navbar navbar-expand-lg justify-content-between align-items-center border-bottom">
|
|
<a class="navbar-brand" id="navbar-title">Party</a>
|
|
<ul class="navbar-nav">
|
|
<a class="nav-item nav-link" id="navbar-bis">best in slot</a>
|
|
<a class="nav-item nav-link" id="navbar-loot">looted items</a>
|
|
</ul>
|
|
<ul class="navbar-nav">
|
|
<a class="nav-item nav-link" id="navbar-users">users</a>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
|
|
<div id="alert-placeholder" class="container"></div>
|
|
|
|
<div class="container">
|
|
<div id="toolbar">
|
|
<button id="add-btn" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add-player-dialog" hidden>
|
|
<i class="bi bi-plus"></i> add
|
|
</button>
|
|
<button class="btn btn-secondary" onclick="reload()">
|
|
<i class="bi bi-arrow-clockwise"></i> reload
|
|
</button>
|
|
<button id="remove-btn" class="btn btn-danger" onclick="removePlayers()" disabled hidden>
|
|
<i class="bi bi-trash"></i> remove
|
|
</button>
|
|
</div>
|
|
|
|
<table id="players" class="table table-striped table-hover"
|
|
data-click-to-select="true"
|
|
data-export-options='{"fileName": "players"}'
|
|
data-page-list="[25, 50, 100, all]"
|
|
data-page-size="25"
|
|
data-pagination="true"
|
|
data-resizable="true"
|
|
data-search="true"
|
|
data-show-columns="true"
|
|
data-show-columns-search="true"
|
|
data-show-columns-toggle-all="true"
|
|
data-show-export="true"
|
|
data-show-fullscreen="true"
|
|
data-show-search-clear-button="true"
|
|
data-single-select="true"
|
|
data-sortable="true"
|
|
data-sort-reset="true"
|
|
data-toolbar="#toolbar">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th data-checkbox="true"></th>
|
|
<th data-sortable="true" data-switchable="false" data-field="nick">nick</th>
|
|
<th data-sortable="true" data-field="job">job</th>
|
|
<th data-sortable="true" data-field="link" data-formatter="bisLinkFormatter">best in slot link</th>
|
|
<th data-sortable="true" data-field="lootCountBiS">total bis pieces looted</th>
|
|
<th data-sortable="true" data-field="lootCountTotal">total pieces looted</th>
|
|
<th data-sortable="true" data-field="priority">priority</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
<div id="add-player-dialog" tabindex="-1" role="dialog" class="modal fade">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">add new player</h4>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="close"></button>
|
|
</div>
|
|
|
|
<form class="modal-body">
|
|
<div class="form-group row">
|
|
<label class="col-sm-4 col-form-label" for="nick">player name</label>
|
|
<div class="col-sm-8">
|
|
<input id="nick" name="nick" class="form-control" placeholder="nick" onkeyup="disableAddPlayerForm()">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-sm-4 col-form-label" for="job">player job</label>
|
|
<div class="col-sm-8">
|
|
<select id="job" name="job" class="form-control" title="job"></select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-sm-4 col-form-label" for="link">link to best in slot</label>
|
|
<div class="col-sm-8">
|
|
<input id="link" name="link" class="form-control" placeholder="link to bis">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-sm-4 col-form-label" for="priority">priority</label>
|
|
<div class="col-sm-8">
|
|
<input id="priority" name="priority" type="number" class="form-control" value="0">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">close</button>
|
|
<button id="submit-player-btn" type="button" class="btn btn-primary" data-bs-dismiss="modal" onclick="addPlayer()" disabled>add</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<footer class="d-flex flex-wrap justify-content-between align-items-center border-top">
|
|
<ul class="nav">
|
|
<li><a class="nav-link" href="/" title="home">home</a></li>
|
|
</ul>
|
|
|
|
<ul class="nav">
|
|
<li><a class="nav-link" href="https://github.com/arcan1s/ffxivbis" title="sources">ffxivbis</a></li>
|
|
<li><a class="nav-link" href="https://github.com/arcan1s/ffxivbis/releases" title="releases list">releases</a></li>
|
|
<li><a class="nav-link" href="https://github.com/arcan1s/ffxivbis/issues" title="issues tracker">report a bug</a></li>
|
|
</ul>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/tableexport.jquery.plugin/tableExport.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/jquery-resizable-columns@0.2.3/dist/jquery.resizableColumns.min.js"></script>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
|
<script src="https://unpkg.com/bootstrap-table@1.19.1/dist/bootstrap-table.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/bootstrap-table@1.19.1/dist/extensions/export/bootstrap-table-export.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/bootstrap-table@1.19.1/dist/extensions/resizable/bootstrap-table-resizable.js"></script>
|
|
|
|
<script src="/static/utils.js"></script>
|
|
<script src="/static/load.js"></script>
|
|
|
|
<script>
|
|
const [partyId, isReadOnly] = getPartyId();
|
|
const table = $("#players");
|
|
const addButton = $("#add-btn");
|
|
const removeButton = $("#remove-btn");
|
|
|
|
const addPlayerDialog = $("#add-player-dialog");
|
|
const submitPlayerButton = $("#submit-player-btn");
|
|
|
|
const jobInput = $("#job");
|
|
const linkInput = $("#link");
|
|
const nickInput = $("#nick");
|
|
const priorityInput = $("#priority");
|
|
|
|
function addPlayer() {
|
|
$.ajax({
|
|
url: `/api/v1/party/${partyId}`,
|
|
data: JSON.stringify({
|
|
action: "add",
|
|
playerId: {
|
|
partyId: partyId,
|
|
job: jobInput.val(),
|
|
nick: nickInput.val(),
|
|
link: linkInput.val() || null,
|
|
priority: parseInt(priorityInput.val(), 10),
|
|
},
|
|
}),
|
|
type: "POST",
|
|
contentType: "application/json",
|
|
success: function (_) { reload(); },
|
|
error: function (jqXHR, _, errorThrown) { requestAlert(jqXHR, errorThrown); },
|
|
});
|
|
}
|
|
|
|
function bisLinkFormatter(link, row) {
|
|
if (link) {
|
|
return `<a href="${safe(link)}" title="${safe(row.nick)} best in slot for ${safe(row.job)}">${safe(link)}</a>`;
|
|
} else {
|
|
return "-";
|
|
}
|
|
}
|
|
|
|
function disableAddPlayerForm() {
|
|
submitPlayerButton.attr("disabled", !nickInput.val());
|
|
}
|
|
|
|
function hideControls() {
|
|
addButton.attr("hidden", isReadOnly);
|
|
removeButton.attr("hidden", isReadOnly);
|
|
}
|
|
|
|
function reload() {
|
|
table.bootstrapTable("showLoading");
|
|
$.ajax({
|
|
url: `/api/v1/party/${partyId}`,
|
|
type: "GET",
|
|
dataType: "json",
|
|
success: function (data) {
|
|
table.bootstrapTable("load", data);
|
|
table.bootstrapTable("uncheckAll");
|
|
table.bootstrapTable("hideLoading");
|
|
},
|
|
error: function (jqXHR, _, errorThrown) { requestAlert(jqXHR, errorThrown); },
|
|
});
|
|
}
|
|
|
|
function removePlayers() {
|
|
const players = table.bootstrapTable("getSelections");
|
|
players.map(function (player) {
|
|
$.ajax({
|
|
url: `/api/v1/party/${partyId}`,
|
|
data: JSON.stringify({
|
|
action: "remove",
|
|
playerId: {
|
|
partyId: partyId,
|
|
job: player.job,
|
|
nick: player.nick,
|
|
},
|
|
}),
|
|
type: "POST",
|
|
contentType: "application/json",
|
|
success: function (_) { reload(); },
|
|
error: function (jqXHR, _, errorThrown) { requestAlert(jqXHR, errorThrown); },
|
|
});
|
|
});
|
|
}
|
|
|
|
$(function () {
|
|
setupFormClear(addPlayerDialog);
|
|
setupRemoveButton(table, removeButton);
|
|
|
|
loadHeader(partyId);
|
|
loadTypes("/api/v1/types/jobs", jobInput);
|
|
|
|
hideControls();
|
|
|
|
table.bootstrapTable({});
|
|
reload();
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |