request accept/remove added
This commit is contained in:
parent
c68a35ef82
commit
2712fa915e
@ -196,6 +196,20 @@ public class DatabaseController {
|
|||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/api/accept_script_request")
|
||||||
|
public String accept_script_request(@RequestParam Map<String, String> params) {
|
||||||
|
long entry_id = Long.parseLong(params.get("entry_id"));
|
||||||
|
ActionScriptRequest req = actionRequestService.getActionScriptById(entry_id);
|
||||||
|
String scriptBody = req.getScriptBody();
|
||||||
|
String name_text = req.getTextName();
|
||||||
|
TextDataVal t1 = textDataValService.save(new TextDataVal(name_text));
|
||||||
|
String desc_text = req.getTextDesc();
|
||||||
|
TextDataVal t2 = textDataValService.save(new TextDataVal(desc_text));
|
||||||
|
actionService.saveScript(new ActionScript(t1.getId(), t2.getId(), scriptBody));
|
||||||
|
actionRequestService.removeById(entry_id);
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/public/api/add_entry_request")
|
@PostMapping("/public/api/add_entry_request")
|
||||||
public String add_entry_request(@RequestParam Map<String, String> params) {
|
public String add_entry_request(@RequestParam Map<String, String> params) {
|
||||||
saveActionRequest(params);
|
saveActionRequest(params);
|
||||||
@ -213,6 +227,7 @@ public class DatabaseController {
|
|||||||
case "heal" -> healthService.removeById(entry_id);
|
case "heal" -> healthService.removeById(entry_id);
|
||||||
case "prof" -> workService.removeById(entry_id);
|
case "prof" -> workService.removeById(entry_id);
|
||||||
case "actions" -> actionService.removeById(entry_id);
|
case "actions" -> actionService.removeById(entry_id);
|
||||||
|
case "script_request" -> actionRequestService.removeById(entry_id);
|
||||||
default -> disasterService.removeById(entry_id);
|
default -> disasterService.removeById(entry_id);
|
||||||
}
|
}
|
||||||
return "ok";
|
return "ok";
|
||||||
|
@ -69,3 +69,4 @@ scrieditde=Below you can write a script for Bunker's action card. On the left si
|
|||||||
edditaddbtn=Edit/Add
|
edditaddbtn=Edit/Add
|
||||||
edditreq=Send request
|
edditreq=Send request
|
||||||
scrireqq=Script requests
|
scrireqq=Script requests
|
||||||
|
acceptbtnreq=Accept
|
@ -69,3 +69,4 @@ scrieditde=Ниже в вашем распоряжении редактор ск
|
|||||||
edditaddbtn=Изменить/Добавить
|
edditaddbtn=Изменить/Добавить
|
||||||
edditreq=Отправить запрос
|
edditreq=Отправить запрос
|
||||||
scrireqq=Запросы на скрипты
|
scrireqq=Запросы на скрипты
|
||||||
|
acceptbtnreq=Принять
|
@ -170,6 +170,12 @@ function get_text_api(tid, cb) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function accept_script_request(obj) {
|
||||||
|
$.post("/api/accept_script_request", "entry_id="+($(obj).attr("data-id")), function(data, status) {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function remove_entry(obj) {
|
function remove_entry(obj) {
|
||||||
$.post("/api/remove_entry", "section="+new URL(window.location.href).searchParams.get("section")+"&entry_id="+($(obj).attr("data-id")), function(data, status) {
|
$.post("/api/remove_entry", "section="+new URL(window.location.href).searchParams.get("section")+"&entry_id="+($(obj).attr("data-id")), function(data, status) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
@ -86,9 +86,15 @@
|
|||||||
<li th:text="${ll}"></li>
|
<li th:text="${ll}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
<th:block th:unless="${section == 'script_request'}">
|
||||||
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="" class="btn btn-primary" th:text="#{eddittsynn}"></a>
|
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="" class="btn btn-primary" th:text="#{eddittsynn}"></a>
|
||||||
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
|
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
|
||||||
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${section == 'script_request'}">
|
||||||
|
<a href="#" th:data-id="${cc.id}" onclick="accept_script_request(this)" class="btn btn-success" th:text="#{acceptbtnreq}"></a>
|
||||||
|
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
||||||
|
</th:block>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</th:block>
|
</th:block>
|
||||||
@ -117,9 +123,15 @@
|
|||||||
<li th:text="${ll}"></li>
|
<li th:text="${ll}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
<th:block th:unless="${section == 'script_request'}">
|
||||||
<a th:unless="${section == 'actions'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="show_synergies_modal(this)" class="btn btn-primary" th:text="#{eddittsynn}"></a>
|
<a th:unless="${section == 'actions'}" href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal_syn" onclick="show_synergies_modal(this)" class="btn btn-primary" th:text="#{eddittsynn}"></a>
|
||||||
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
|
<a href="#" th:data-id="${cc.id}" data-bs-toggle="modal" data-bs-target="#modal" onclick="edit_entry(this)" class="btn btn-primary" th:text="#{edditbtn}"></a>
|
||||||
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${section == 'script_request'}">
|
||||||
|
<a href="#" th:data-id="${cc.id}" onclick="accept_script_request(this)" class="btn btn-success" th:text="#{acceptbtnreq}"></a>
|
||||||
|
<a href="#" th:data-id="${cc.id}" onclick="remove_entry(this)" class="btn btn-danger" th:text="#{remombtn}"></a>
|
||||||
|
</th:block>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user