@for (int i = 0; i < Model.Count; i++)
{
<div class="col-sm-3" style="margin-bottom: 5px;">
@{
string backgroundColor = Constants.Colors.EVENT_CUSTOM_TYPE;
string hoverColor = Constants.Colors.EVENT_CUSTOM_BACKGROUND;
switch (Model[i].Type)
{
case EventType.Call:
{
backgroundColor = Constants.Colors.EVENT_CALL_TYPE;
hoverColor = Constants.Colors.EVENT_CALL_BACKGROUND;
break;
}
case EventType.Meeting:
{
backgroundColor = Constants.Colors.EVENT_MEETING_TYPE;
hoverColor = Constants.Colors.EVENT_MEETING_BACKGROUND;
break;
}
case EventType.Process:
{
backgroundColor = Constants.Colors.EVENT_PROCESS_TYPE;
hoverColor = Constants.Colors.EVENT_PROCESS_BACKGROUND;
break;
}
}
}
<a id="user-event-@i" href="@Url.Action("Details", "Event", new { @id = @Model[i].Id })">
<div style="width: 100%; min-height: 110px; border-top: 2px solid #CFCED1; border-left: 1px solid #CFCED1; border-right: 1px solid #CFCED1; background-color: @backgroundColor; cursor: pointer;">
</div>
</a>
</div>
}
a[id|=user-event]:hover {
...
}
начни с того момент когда ты открываешь модалку
$("#submitBtn").on('click', () => {
let updateData = {
note: $("#note").val(),
clientId: @Model.ClientId,
};
$.ajax({
url: '@Url.Action("Create", "Note")',
method: 'post',
data: JSON.stringify(updateData),
dataType: 'json',
contentType: 'application/json; charset=utf-8;',
success: (response) => {
let clientNote = response.note;
let appendNotemakrup = '<div id="client-personal-note-' + clientNote.id + '" class="card card-body alert-success">' +
'<i class="text-break" id="note-' + clientNote.id + '">' + clientNote.note + '</i>' +
'<b>@localizator["JustCreated"]</b>' +
'<br />';
document.getElementById('client-personal-note-container').innerHTML += appendNotemakrup;
$('#note').val('');
location.href = '#client-personal-note-' + clientNote.id;
setTimeout(() => {
$('#client-personal-note-' + clientNote.id).removeClass('alert-success');
}, 3000);
},
error: (response) => {
let jsonResponse = JSON.parse(response.responseText);
if (jsonResponse.hasOwnProperty("Note")) {
document.getElementById('note-error-label').innerHTML = jsonResponse.Note;
}
if (jsonResponse.hasOwnProperty("errorMessage")) {
document.getElementById('note-error-label').innerHTML = jsonResponse.errorMessage;
}
},
});
});