Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monorepo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ Global
{CB6E63D0-FE51-401A-94C5-69486252F426} = {B3719C53-CAF3-4DBA-9804-B3669A1AFFFD}
{B1D71BD1-52C0-44E0-BC3B-590852021521} = {B3719C53-CAF3-4DBA-9804-B3669A1AFFFD}
EndGlobalSection
EndGlobal
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public sealed class FreeTimeBackstage : _BaseEntity
public Guid TimeSelectionId { get; set; }
public int MaxParticipants { get; set; }
public bool Ilimitado { get; set; }
public bool AutoAccept { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ public sealed class TimeSelection : _BaseEntity

[NotMapped]
public bool Ilimitado { get; set; }

[NotMapped]
public bool AutoAccept { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ public sealed class ScheduleTimeSelectionRequestModel
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public List<string> TagsSelected { get; set; } = new();

public bool AutoAccept { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Domain.Contracts;
using Domain.Entities;
using Domain.Entities;
using Domain.Enums;

namespace Domain.Models.ViewModels;
Expand All @@ -16,5 +15,4 @@ public class TimeSelectionForRequestedHelpViewModel
public string? ImagePath { get; set; }
public int Variation { get; set; }
public EnumTipoTimeSelection Type { get; set; } = EnumTipoTimeSelection.RequestHelp;
public List<HelpResponseWithProfileData> HelpResponses { get; set; } = [];
}
4 changes: 4 additions & 0 deletions src/APP.Platform/Pages/Canal/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ public async Task<ActionResult> OnPostTrySetMentor()
{
JoinTime.StatusJoinTime = StatusJoinTime.Marcado;
}
else if (freeTimeBackstage?.AutoAccept ?? false)
{
JoinTime.StatusJoinTime = StatusJoinTime.Marcado;
}
else
{
JoinTime.StatusJoinTime = StatusJoinTime.Pendente;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@
<br>
<br>
</form>

@if (Model.IsLogedUser)
{
<div id="help-response">
@* o textarea para incluir comentario de ajuda esta sendo carregado aqui *@
</div>
}

<div id="container-msg-helpResponse">

</div>

<div id="space-helpResponses">
@* os comentarios de ajuda estao sendo carregados aqui *@
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
public class FormsRequestHelp
{
public ScheduleTimeSelectionRequestModel ScheduleTimeSelection { get; set; } = new();
public ScheduleFreeTimeForTimeSelectionRequestModel? ScheduleFreeTimeForTimeSelection { get; set; }
public Dictionary<string, List<string>>? RelatioTags { get; set; }
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
</select>
<div id="selected-tags-container"></div>
</div>
<div style="padding: 15px 0px; font-size: 16px;" class="d-flex align-items-center">
<input type="checkbox" id="autoJoinTime" asp-for="ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept"
value="true" />
<input type="hidden" asp-for="ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept" value="false" />
<label style="margin-left:5px" for="autoJoinTime">Ativar Seleção Automática de Interessados</label>
</div>
<div style="text-align: end">
<button
id="btnOneToOne1"
Expand Down Expand Up @@ -339,4 +345,7 @@ schedule
</div>

<script src="~/js/OneToOneEvent/ValidacaoOneToOne.js" asp-append-version="true"></script>
<script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

script não utilzado


</script>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,21 @@
<span asp-for="ScheduleTimeSelection.Descricao" style="color: firebrick">*</span> <small style="font-size: 12px; color: #525252;, font-weight: 400;">(mínimo de 50 caracteres)</small></label>
<textarea id="descriptionRH" rows="4" asp-for="ScheduleTimeSelection.Descricao"></textarea>
</div>
<div class="request-help-input-div">
<div class="request-help-input-div">
<label
asp-for="ScheduleTimeSelection.ImageFile"
style="margin-top: 20px;"
class="control-label oneToOneLabel">Imagem <small style="font-size: 12px; color: #525252;, font-weight: 400;">(opcional)</small></label>
<input type="file" asp-for="ScheduleTimeSelection.ImageFile" />
</div>
<div style="
margin-bottom: 0; padding-inline: 1.4rem;" class="btn-conferir-informacao">
</div>
<div style="padding: 15px 0px; font-size: 16px;" class="d-flex align-items-center">
<input type="checkbox" id="autoJoinTime" asp-for="ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept" value="true" />
<input type="hidden" asp-for="ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept" value="false" />
<label style="margin-left:5px" for="autoJoinTime">Ativar Seleção Automática de Interessados</label>
</div>

<div style="margin-bottom: 0; padding-inline: 1.4rem;" class="btn-conferir-informacao">

<button
id="btnRequestHBack1"
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ ExperienceLevel[] valuesExperience = (ExperienceLevel[])Enum.GetValues(typeof(Ex
}

<nav>
@if(!data.Key.Ilimitado){
@if(!data.Key.Ilimitado || !data.Key.AutoAccept){

<button type="button" class='button-card button-mentoria nav-link'
style="width: fit-content; font-size: 13px; padding: 5px;" onclick="showInteressados('@data.Key.Id')"
Expand Down
9 changes: 2 additions & 7 deletions src/APP.Platform/Pages/Components/_AjudarOptions.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,8 @@
}
}
function openCursosAndEventos() {
if(isAuthenticated){
$('#eventModalCustosAndEventos').modal('show')
} else{
alert("Você precisa estar logado para acessar esta funcionalidade.");
window.location.href = "/Identity/Account/Login";
loginCallbackCursosAndEventos();
}
$("#tipoTempoLivre").val("cursos");
openTimePicker()
}
function openTimePicker(){
$("#ajudarModal").modal("hide");
Expand Down
9 changes: 4 additions & 5 deletions src/APP.Platform/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,17 @@
new FormsRequestHelp
{
ScheduleTimeSelection = Model.ScheduleTimeSelection!,
ScheduleFreeTimeForTimeSelection = Model.ScheduleFreeTimeForTimeSelection,
RelatioTags = Model.RelatioTags,
})
<form id="forgery" method="post">
@Html.AntiForgeryToken()
</form>


<script defer src="~/js/CursosAndEventosFlow.js"></script>
<script defer src="~/js/timePickerFlow.js"></script>
<script defer src="~/js/ScheduleLiveFlow.js"></script>
<script defer src="~/js/liveOriginVerification.js"></script>
<script defer src="~/js/OneToOneEvent/OneToOneFlow.js"></script>
<script defer src="~/js/RequestHelpEvent/RequestHelpFlow.js"></script>
<script defer src="~/js/CursosAndEventos/CursosAndEventosFlow.js"></script>
<script defer src="~/js/RequestHelpEvent/RequestHelpFlow.js"></script>



Expand Down
43 changes: 5 additions & 38 deletions src/APP.Platform/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
using System.Text.Json;
using APP.Platform.Services;
using Background;
using Domain.Contracts;
using Domain.Entities;
using Domain.Enums;
using Domain.Models.ViewModels;
using Domain.RequestModels;
using Domain.WebServices;
using Infrastructure.Data.Contexts;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Platform.Services;
using Presentation.EndPoints;
using Queue;
Expand All @@ -39,7 +35,6 @@ public class IndexModel(
IMessagePublisher messagePublisher,
IAprenderService aprenderService,
IPerfilWebService perfilWebService,
IHelpResponseWebService helpResponseWebService,
Settings settings
) : CustomPageModel(context, httpClientFactory, httpContextAccessor, settings)
{
Expand Down Expand Up @@ -664,8 +659,7 @@ public async Task<ActionResult> OnGetAfterLoadRequestedHelp()
timeSelectionGroupByPerfilId,
_context,
_httpClientFactory,
perfilWebService,
helpResponseWebService
perfilWebService
);

return new JsonResult(new { pedidos, isLogged = IsAuth });
Expand Down Expand Up @@ -713,6 +707,10 @@ public async Task<ActionResult> OnPostTrySetMentor()
{
JoinTime.StatusJoinTime = StatusJoinTime.Marcado;
}
else if (freeTimeBackstage?.AutoAccept ?? false)
{
JoinTime.StatusJoinTime = StatusJoinTime.Marcado;
}
else
{
JoinTime.StatusJoinTime = StatusJoinTime.Pendente;
Expand Down Expand Up @@ -960,35 +958,4 @@ public IActionResult Base64toImage(string base64)

return File(imageBytes, "image/png");
}

public async Task<IActionResult> OnPostHelpResponse(string timeSelectionId, string content)
{
if (content.IsNullOrEmpty())
return BadRequest("Necessário preencher o conteúdo da ajuda.");
var perfilId = UserProfile.Id;
var request = new CreateHelpResponse(Guid.Parse(timeSelectionId), perfilId, content);

var response = await helpResponseWebService.Add(request);
return new JsonResult(
new HelpResponseWithProfileData(
response,
UserProfile.UserName,
UserProfile.Nome,
UserProfile.Foto
)
);
}

public async Task<IActionResult> OnPostDeleteHelpResponse(string helpResponseId)
{
try
{
await helpResponseWebService.Update(Guid.Parse(helpResponseId));
return new EmptyResult();
}
catch (Exception err)
{
return BadRequest(err.Message);
}
}
}
27 changes: 19 additions & 8 deletions src/APP.Platform/Pages/ScheduleActions/index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public Dictionary<
private readonly IAprenderService _AprenderService;
private readonly IHttpClientFactory _httpClientFactory;
private IPerfilWebService _perfilWebService { get; set; }
private IHelpResponseWebService _helpResponseWebService { get; set; }

public ScheduleActionsModel(
IRazorViewEngine viewEngine,
Expand All @@ -113,8 +112,7 @@ public ScheduleActionsModel(
OpenAiService openAiService,
Settings settings,
IAliasService aliasService,
IPerfilWebService perfilWebService,
IHelpResponseWebService helpResponseWebService
IPerfilWebService perfilWebService
)
: base(context, httpClientFactory, httpContextAccessor, settings)
{
Expand All @@ -128,7 +126,6 @@ IHelpResponseWebService helpResponseWebService
_openAiService = openAiService;
_aliasService = aliasService;
_perfilWebService = perfilWebService;
_helpResponseWebService = helpResponseWebService;
RelatioTags = DataTags.GetTags();
TagsSelected = new();
TimeSelectionList = new();
Expand Down Expand Up @@ -351,6 +348,11 @@ public async Task<IActionResult> OnGetRenderCalendarAsync()

time.Key.MaxParticipants = max;
time.Key.Ilimitado = freeTimeBackstage?.Ilimitado ?? false;
time.Key.AutoAccept = freeTimeBackstage?.AutoAccept ?? false;
if(time.Key.Ilimitado)
{
time.Key.RoomId = CreatePrivateRoom(time.Key, time.Key.PerfilId ?? Guid.Empty);
}
}

var RhListIds = requestHelpList.Keys.Select(kvp => kvp.Id).ToList();
Expand Down Expand Up @@ -660,6 +662,15 @@ public IActionResult OnGetPartialFreeTimePanel(string timeSelectionId)

timeSelectionAndJoinTimes.Key.MaxParticipants = freeTimeBackstage?.MaxParticipants ?? 1;
timeSelectionAndJoinTimes.Key.Ilimitado = freeTimeBackstage?.Ilimitado ?? false;
if (timeSelectionAndJoinTimes.Key.Ilimitado)
{
timeSelectionAndJoinTimes.Key.RoomId = CreatePrivateRoom(
timeSelectionAndJoinTimes.Key,
timeSelectionAndJoinTimes.Key.PerfilId ?? Guid.Empty
);
}

timeSelectionAndJoinTimes.Key.AutoAccept = freeTimeBackstage?.AutoAccept ?? false;

_ensinarService.CheckActionNeedAndUpdateTime(timeSelectionAndJoinTimes);

Expand Down Expand Up @@ -1156,6 +1167,7 @@ public async Task<ActionResult> OnPostSaveTime()
EndTime = ScheduleTimeSelection.EndTime,
Variacao = ScheduleTimeSelection.Variacao,
TituloTemporario = ScheduleTimeSelection.Titulo,
AutoAccept = ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept
};

if (TimeSelection.StartTime < DateTime.Now)
Expand Down Expand Up @@ -1214,6 +1226,7 @@ public async Task<ActionResult> OnPostSaveTime()
TimeSelection.TituloTemporario = ScheduleTimeSelection.Titulo;
TimeSelection.Tipo = ScheduleTimeSelection.Tipo;
TimeSelection.Status = ScheduleTimeSelection.Status;
TimeSelection.AutoAccept = ScheduleFreeTimeForTimeSelection.TimeSelectionBackstage.AutoAccept;

var tags = ProcessTimeSelection.ProcessingTags(
TimeSelection.Id.ToString(),
Expand Down Expand Up @@ -1498,8 +1511,7 @@ await GetFreeTimeService.PrepareViewModelForRenderRequestedHelpBoard(
timeSelectionGroupByPerfilId,
_context,
_httpClientFactory,
_perfilWebService,
_helpResponseWebService
_perfilWebService
);
return new JsonResult(new { pedidos = RequestedHelp, isLogged = IsAuth });
}
Expand All @@ -1519,8 +1531,7 @@ await GetFreeTimeService.PrepareViewModelForRenderRequestedHelpBoard(
timeSelectionGroupByPerfilId,
_context,
_httpClientFactory,
_perfilWebService,
_helpResponseWebService
_perfilWebService
);
return new JsonResult(new { pedidos = RequestedHelp, isLogged = IsAuth });
}
Expand Down
Loading