Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c42d522d

Přidáno uživatelem Dominik Chlouba před téměř 4 roky(ů)

Comments, sending goal accept request

Zobrazit rozdíly:

src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
5 5
<aside class="@_aside goal_detail">
6 6
    <div class="goal_detail_header">
7 7
        <div>
8
            @if (DetailItem.GoalDefinition is not null)
9
            {
8 10
            @if (DetailItem.SupervisorLocked && DetailItem.OwnerLocked)
9 11
            {
10 12
                <button class="authorize_button accepted">Schváleno</button>
11 13
            }
12
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.CreatorId && !DetailItem.OwnerLocked)
14
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.OwnerId && !DetailItem.OwnerLocked)
13 15
            {
14
                <button class="authorize_button">Odeslat ke schválení</button>
16
                <button class="authorize_button" @onclick="SubmitGoal">Odeslat ke schválení</button>
15 17
            }
16
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.CreatorId && DetailItem.OwnerLocked)
18
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.OwnerId && DetailItem.OwnerLocked)
17 19
            {
18 20
                <button class="authorize_button">Čeká na schválení</button>
19 21
            }
20
            else if (_provider.RequiredUserId != DetailItem.GoalDefinition.CreatorId && DetailItem.OwnerLocked && !DetailItem.SupervisorLocked)
22
            else if (_provider.RequiredUserId != DetailItem.GoalDefinition.OwnerId && DetailItem.OwnerLocked && !DetailItem.SupervisorLocked)
21 23
            {
22
                <button class="authorize_button accepted">Schválit</button>
23
                <button class="authorize_button">Zamítnout</button>
24
                <button class="authorize_button" @onclick="AcceptGoal">Schválit</button>
25
                <button class="authorize_button" @onclick="DeclineGoal">Zamítnout</button>
24 26
            }
25 27
            @for (var i = 0; i < DetailItem.Reviews.Where(o => !o.IsFinal).ToList().Count; i++)
26 28
            {
27
                <div class="review_button accepted" @onclick="() =>SetReviewId(Guid.NewGuid())">
29
                <div class="review_button accepted" @onclick="() => SetReviewId(Guid.NewGuid())">
28 30
                    @(i + 1) <i class="fal fa-trophy"></i>
29 31
                </div>
30 32
            }
......
34 36
                <i class="fal fa-trophy-alt"></i>
35 37
            </div>              
36 38
            }
37
            @if (DetailItem.Reviews.Count < 3)
39
            @if (DetailItem.SupervisorLocked && DetailItem.OwnerLocked && DetailItem.Reviews.Count < 3)
38 40
            {
39
                <button class="authorize_button" @onclick="() =>SetReviewId(Guid.NewGuid())">Vytvořit @(DetailItem.Reviews.Count < 2 ? DetailItem.Reviews.Count + 1 : "finální"). hodnocení</button>
41
                <button class="authorize_button" @onclick="() => SetReviewId(Guid.NewGuid())">Vytvořit @(DetailItem.Reviews.Count < 2 ? DetailItem.Reviews.Count + 1 : "finální"). hodnocení</button>
42
            }
40 43
            }
41 44
        </div>
42 45
        <div>
......
51 54
            <div class="goal_description_title">Popis cíle</div>
52 55
            <textarea oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
53 56
                      class="goal_description" placeholder="Vyplňte popis cíle" @bind="Description" disabled="@(DetailItem.SupervisorLocked || DetailItem.OwnerLocked)"></textarea>
54
            <button class="edit_goal_desc" @onclick="EditGoal">Uložit změny</button>
57
            @if (!(DetailItem.SupervisorLocked || DetailItem.OwnerLocked))
58
            {
59
                <button class="edit_goal_desc" @onclick="EditGoal">Uložit změny</button>
60
            }
55 61
        </div>
56 62
        <div class="goal_communication_area">
57 63
            @foreach (var comment in Comments)
......
67 73
        <div class="goal_communication_item">
68 74
            <div class="item_tool">
69 75
                <div>
70
                    @comment.Creator.Name.FullName: @comment.Text <span class="date">>@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
76
                    @comment.Creator.Name.FullName<span class="date">@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
71 77
                </div>
72 78
                <div>
73 79
                    @if (CommentEditId != comment.Id)
......
425 431

  
426 432
    public void DeleteComment(Guid id)
427 433
    {
428

  
434
        var result = _mediator.Send(new RemoveComment.Command(id)).Result;
435
        if (result.IsSuccess) GetDetails().Wait();
429 436
    }
430 437

  
431 438
    public void UpdateComment()
432 439
    {
433

  
440
        var result = _mediator.Send(new EditComment.Command(CommentEditId, CommentEditText)).Result;
441
        if (result.IsSuccess) GetDetails().Wait();
442
        DiscardComment();
434 443
    }
435 444

  
436 445
    public void DiscardComment() => (CommentEditId, CommentEditText) = (default(Guid), "");
437 446

  
447
    public async Task SubmitGoal()
448
    {
449
        var response = await _mediator.Send(new LockGoal.Command(DetailId));
450
        if (response.IsSuccess) await GetDetails();
451
        else toastService.ShowError(response.Errors.First());
452
    }
453

  
454
    public async Task AcceptGoal()
455
    {
456
        var response = await _mediator.Send(new LockGoal.Command(DetailId));
457
        if (response.IsSuccess) await GetDetails();
458
        else toastService.ShowError(response.Errors.First());
459
    }
460

  
461
    public async Task DeclineGoal()
462
    {
463
    }
464

  
438 465
    private async Task GetDetails()
439 466
    {
440 467
        var response = await _mediator.Send(new GetGoalById.Query(DetailId));
src/Modules/Goal/Application/Leuze.Modules.Goal.Application/CQRS/Comments/Commands/EditComment.cs
14 14
{
15 15
    public static class EditComment
16 16
    {
17
        public record Command(Guid commentId, string text, bool isPrivate) : IBaseRequest<Response>;
17
        public record Command(Guid commentId, string text) : IBaseRequest<Response>;
18 18

  
19 19
        public record Response();
20 20

  
......
59 59

  
60 60
                comment.SetText(request.text);
61 61

  
62
                if (request.isPrivate)
63
                {
64
                    comment.SetPrivate();
65
                }
66
                else
67
                {
68
                    comment.SetPublic();
69
                }
70

  
71 62
                await _commentRepo.UpdateRepo();
72 63

  
73 64
                return RequestResponse<Response>.CreateSuccessResponse(new());

Také k dispozici: Unified diff