This commit is contained in:
Danil Markov 2023-05-19 13:11:40 +04:00
parent 5f5f175a0d
commit 7bc6efdc0c
13 changed files with 147 additions and 120 deletions

View File

@ -79,7 +79,7 @@ namespace UniversityBusinessLogic.BusinessLogics
ReportStreamStudentEdStatPeriodViewModel reportData = new ReportStreamStudentEdStatPeriodViewModel();
reportData.StreamName = stream.Name;
var students = _streamStorage.GetStreamStudents(new() { Id = stream.Id })
var students = _streamStorage.GetStreamStudents(new() { Id = stream.Id, DateFrom = model.DateFrom, DateTo = model.DateTo })
.Select(s => new StudentStatusViewModel()
{
StudentName = s.Name + " " + s.Surname,
@ -131,7 +131,7 @@ namespace UniversityBusinessLogic.BusinessLogics
_mailSender.SendMailAsync(new ()
{
MailAddress = reportModel.UserEmail,
Subject = "Отчет по комплектациям",
Subject = "Отчет по статусам обучения",
Text = $"За период с {reportModel.DateFrom.ToShortDateString()} " +
$"по {reportModel.DateTo.ToShortDateString()}.",
File = file

View File

@ -12,5 +12,7 @@ namespace UniversityContracts.SearchModels
public int? UserId { get; set; }
public string? Name { get; set; }
public int? Course { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
}
}

View File

@ -135,6 +135,7 @@ namespace UniversityDataBaseImplemet.Implements
using var context = new Database();
var students = context.StudentStreams
.Where(x => x.StreamId == model.Id)
.Where(x => x.Student.DateOfAddmission < model.DateTo && x.Student.DateOfAddmission >= model.DateFrom)
.Select(x => x.Student.GetViewModel)
.ToList();
return students;

View File

@ -164,6 +164,11 @@ namespace UniversityProvider.Controllers
APIClient.PostRequest("api/reportprovider/sendbymailstatusreport", reportModel);
}
public IActionResult Diagram()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{

View File

@ -0,0 +1,28 @@
<div>
<canvas id="myChart"></canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>

View File

@ -34,6 +34,9 @@
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="GetReport">Отчет</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Diagram">График</a>
</li>
</ul>
</div>
</div>

View File

@ -4,6 +4,16 @@ const nameInput = document.getElementById("name-input")
var students = []
var dataArray = [];
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
window.addEventListener('load', () => {
$.ajax({
url: "/student/getallbyuser",
@ -16,6 +26,12 @@ window.addEventListener('load', () => {
})
createBtn.addEventListener('click', () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
var document = {
"Name": nameInput.value,
"Date": new Date(),

View File

@ -6,6 +6,16 @@ var students = [];
var dataArray = [];
var currentDocument = null;
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
window.addEventListener('load', async () => {
await $.ajax({
url: "/student/getallbyuser",
@ -25,6 +35,12 @@ window.addEventListener('load', async () => {
})
createBtn.addEventListener('click', () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
var documentGroupsUpdate = {
"Id": currentDocument.id,
"Name": nameInput.value,

View File

@ -1,6 +1,16 @@
const createBtn = document.getElementById("create-button");
const nameInput = document.getElementById("name-input");
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -8,19 +18,6 @@ createBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let educationstatus = {
"Name": nameInput.value,
};

View File

@ -2,6 +2,16 @@
const nameInput = document.getElementById("name-input")
const studId = document.getElementById("vb-id").dataset.id
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -9,19 +19,6 @@ updateBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
updateBtn.addEventListener("click", () => {
let educationstatus = {
"Id": parseInt(studId),
"Name": nameInput.value,

View File

@ -21,39 +21,7 @@ generateButton.addEventListener("click", () => {
}).done((data) => {
dateFromSpan.innerHTML = reportModel["DateFrom"].toLocaleDateString();
dateToSpan.innerHTML = reportModel["DateTo"].toLocaleDateString();
/*renderTable(reportData);*/
// Добавление данных
for (var i = 0; i < data.length; i++) {
var streamData = data[i];
var streamName = streamData.streamName;
// Добавление строки для каждого студента в потоке
for (var j = 0; j < streamData.studentStatus.length; j++) {
var student = streamData.studentStatus[j];
if (j === 0) {
var row = tbody.insertRow();
var streamNameCell = row.insertCell()
streamNameCell.textContent = streamName;
var studentNameCell = row.insertCell();
var dateOfAdmissionCell = row.insertCell();
var studentStatusCell = row.insertCell();
tbody.appendChild(row)
}
var row = tbody.insertRow();
var streamNameCell = row.insertCell()
var studentNameCell = row.insertCell();
studentNameCell.textContent = student.studentName;
var dateOfAdmissionCell = row.insertCell();
dateOfAdmissionCell.textContent = formatDate(student.dateOfAddmission);
var studentStatusCell = row.insertCell();
studentStatusCell.textContent = student.educationStatus;
tbody.appendChild(row);
}
}
renderTable(data);
});
});
@ -82,40 +50,40 @@ sendByMailButton.addEventListener("click", () => {
});
});
tbody.innerHTML = "";
/*reportData.forEach((record) => {
const cars = record.cars;
const works = record.works;
const recordHeight = Math.max(cars.length + 1, works.length + 1);
for (let i = 0; i < recordHeight; i++) {
let cellsData = ["", "", "", ""];
if (i === 0) {
cellsData[0] = record.equipmentName;
cellsData[1] = getDate(record.equipmentDateCreate);
createTableRow(cellsData);
continue;
}
let k = i - 1;
if (k < cars.length) {
cellsData[2] = cars[k];
}
if (k < works.length) {
cellsData[3] = works[k];
}
createTableRow(cellsData);
}
});*/
const renderTable = (reportData) => {
console.log(reportData)
reportData.forEach((item) => {
var streamName = item.streamName;
var students = []
item.studentStatus.forEach((stud) => {
students.push({ studentName: stud.studentName, educationStatus: stud.educationName });
})
createTableSection(streamName, students);
})
const renderTable = (data) => {
tbody.innerHTML = "";
for (var i = 0; i < data.length; i++) {
var streamData = data[i];
var streamName = streamData.streamName;
for (var j = 0; j < streamData.studentStatus.length; j++) {
var student = streamData.studentStatus[j];
if (j === 0) {
var row = tbody.insertRow();
var streamNameCell = row.insertCell()
streamNameCell.textContent = streamName;
var studentNameCell = row.insertCell();
var dateOfAdmissionCell = row.insertCell();
var studentStatusCell = row.insertCell();
tbody.appendChild(row)
}
var row = tbody.insertRow();
var streamNameCell = row.insertCell()
var studentNameCell = row.insertCell();
studentNameCell.textContent = student.studentName;
var dateOfAdmissionCell = row.insertCell();
dateOfAdmissionCell.textContent = formatDate(student.dateOfAddmission);
var studentStatusCell = row.insertCell();
studentStatusCell.textContent = student.educationStatus;
tbody.appendChild(row);
}
}
}
const createTableSection = (streamName, students) => {

View File

@ -4,6 +4,16 @@ const surnameInput = document.getElementById("surname-input")
const dateInput = document.getElementById("date-input")
const studCardInput = document.getElementById("studcard-input")
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -11,19 +21,6 @@ createBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let student = {
"Name": nameInput.value,
"Surname": surnameInput.value,

View File

@ -5,6 +5,16 @@ const dateInput = document.getElementById("date-input")
const studCardInput = document.getElementById("studcard-input")
const studId = document.getElementById("vb-id").dataset.id
const correctData = () => {
return true;
};
const validate = () => {
return true;
};
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
@ -12,19 +22,6 @@ updateBtn.addEventListener("click", () => {
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
updateBtn.addEventListener("click", () => {
let student = {
"Id": parseInt(studId),
"Name": nameInput.value,