Anton Romanov 311b8a4c5c
Some checks failed
CI fuzzy controller / container-test-job (push) Failing after 1m15s
#4 -- Now you can delete antecedents
2025-02-28 14:37:00 +04:00

85 lines
4.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}">
<head>
<title>Редактирование проекта</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<div class="container" layout:fragment="content">
<h3>Редактирование проекта:</h3>
<form th:action="@{/project/save}" th:object="${project}" method="post">
<input type="hidden" th:field="*{id}">
<div class="form-group">
<label for="name">Название</label>
<input th:field="*{name}" id="name" type="text" required class="form-control" placeholder="Название">
<p th:if="${#fields.hasErrors('name')}" th:class="${#fields.hasErrors('name')}? error">
Не может быть пустым
</p>
</div>
<div class="form-group">
<label th:text="'Дата создания: ' + ${#dates.format(project.createDate, 'dd.MM.yyyy HH:mm')}"></label>
</div>
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
<button name="delete" type="submit" class="btn btn-outline-dark" onclick="return confirm('Удалить запись?')">
Удалить
</button>
<a href="/project/list" class="btn btn-outline-dark">Отмена</a>
</form>
<hr/>
<div class="row">
<div class="col col-md-6">
<h4> Список переменных</h4>
<div class="form-group">
<div class="row" th:each="v, iter : ${variables}">
<div class="col col-md-12">
<a th:href="@{'/variable/edit/' + ${projectId}+'/'+${v.id}}">
<span class="badge badge-light" th:text="${iter.index+1} + '. ' + ${v.name}"></span>
</a>
</div>
</div>
</div>
<a th:href="@{'/variable/edit/' + ${projectId}+'/0'}" class="btn btn-outline-dark">Добавить преременную</a>
</div>
<div class="col col-md-6">
<h4> Список правил</h4>
<div class="form-group">
<div class="row" th:each="r, iter : ${rules}">
<div class="col col-md-12">
<a th:href="@{'/rule/edit/' + ${projectId}+'/'+${r.id}}">
<div class="rule row" th:text="${r.content}"></div>
</a>
</div>
</div>
</div>
<a th:href="@{'/rule/edit/' + ${projectId}+'/0'}" th:if="${not #lists.isEmpty(variables)}"
class="btn btn-outline-dark">Добавить правило</a>
</div>
</div>
<script type="text/javascript" src="/js/fuzzyRule.js"></script>
<script>
function addRule(index, el, rule) {
ruleHtml = "<div class='col col-md-12'><span class='badge badge-light'>"+(index+1) +". Если</span></div>"
antecedentComponents = getAntecedentComponents(getAntecedent(rule));
for (let i = 0; i < antecedentComponents.length; i++) {
a = antecedentComponents[i];
if (i > 0) {
ruleHtml += "<div class='col col-md-1'><span class='badge badge-danger'>И</span></div>";
} else {
ruleHtml += "<div class='col col-md-1'></div>";
}
ruleHtml += "<div class='col col-md-4'><span class='badge badge-primary'>"+getVariable(a)+"</span></div>";
ruleHtml += "<div class='col col-md-3'><span class='badge badge-light'>есть</span></div>";
ruleHtml += "<div class='col col-md-4'><span class='badge badge-success'>"+getVariableValue(a)+"</span></div>";
}
$(el).html(ruleHtml);
}
$('.rule').each(function(index) {
addRule(index, $(this), $(this).text());
});
</script>
</div>
</html>