Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c4ecb32e

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

Updating and removing comments, button for accepting and declining goals

Zobrazit rozdíly:

src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/Pages/Components/GoalDetailAside.razor
1 1
@inject IMediator _mediator
2 2
@inject IToastService toastService
3
@inject AuthenticatedUserProvider _provider
3 4

  
4 5
<aside class="@_aside goal_detail">
5 6
    <div class="goal_detail_header">
6 7
        <div>
7
            <button class="authorize_button accepted">Schválit</button>
8
            @if (DetailItem.SupervisorLocked && DetailItem.OwnerLocked)
9
            {
10
                <button class="authorize_button accepted">Schváleno</button>
11
            }
12
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.CreatorId && !DetailItem.OwnerLocked)
13
            {
14
                <button class="authorize_button">Odeslat ke schválení</button>
15
            }
16
            else if (_provider.RequiredUserId == DetailItem.GoalDefinition.CreatorId && DetailItem.OwnerLocked)
17
            {
18
                <button class="authorize_button">Čeká na schválení</button>
19
            }
20
            else if (_provider.RequiredUserId != DetailItem.GoalDefinition.CreatorId && DetailItem.OwnerLocked && !DetailItem.SupervisorLocked)
21
            {
22
                <button class="authorize_button accepted">Schválit</button>
23
                <button class="authorize_button">Zamítnout</button>
24
            }
25
            else
26
            {
27
                <button class="authorize_button accepted">Schváleno</button>
28
            }
8 29
            <div class="review_button accepted" @onclick="() =>SetReviewId(Guid.NewGuid())">
9 30
                1 <i class="fal fa-trophy"></i>
10 31
            </div>
......
28 49
            <div class="goal_description_title">Popis cíle</div>
29 50
            <textarea oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
30 51
                      class="goal_description" placeholder="Vyplňte popis cíle" @bind="Description"></textarea>
31
            <button @onclick="EditGoal">Uložit změny</button>
52
            <button class="edit_goal_desc" @onclick="EditGoal">Uložit změny</button>
32 53
        </div>
33 54
        <div class="goal_communication_area">
34 55
            @foreach (var comment in Comments)
......
36 57
                if (comment.IsSystem)
37 58
                {
38 59
                    <div class="goal_communication_item">
39
                        System: Uživatel @comment.Creator.Name.FullName @comment.type.GetStringValue() z @comment.OldText na @comment.Text <span class="date">@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
60
                        Uživatel @comment.Creator.Name.FullName @comment.type.GetStringValue() z @comment.OldText na @comment.Text <span class="date">@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
40 61
                    </div>
41 62
                }
42 63
                else
43 64
                {
44
                    <div class="goal_communication_item">
45
                        <div class="item_tool">
46
                            <div>
47
                                @comment.Creator.Name.FullName: @comment.Text <span class="date">>@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
48
                            </div>
49
                            <div>
50
                                <div class="action_buttons" style="display: none">
51
                                    <i class="fal fa-edit"></i>
52
                                    <i class="fal fa-trash"></i>
53
                                </div>
54
                                <div class="action_buttons" style="display: block">
55
                                    <i class="green fal fa-check"></i>
56
                                    <i class="red fal fa-times"></i>
57
                                </div>
58
                            </div>
65
        <div class="goal_communication_item">
66
            <div class="item_tool">
67
                <div>
68
                    @comment.Creator.Name.FullName: @comment.Text <span class="date">>@comment.CreatedAt.ToShortDateString() @comment.CreatedAt.ToShortTimeString()</span>
69
                </div>
70
                <div>
71
                    @if (CommentEditId != comment.Id)
72
                    {
73
                        <div class="action_buttons">
74
                            <span @onclick="() => OpenCommentEdit(comment.Id, comment.Text)"><i class="fal fa-edit"></i></span>
75
                            <span @onclick="() => DeleteComment(comment.Id)"><i class="fal fa-trash"></i></span>
59 76
                        </div>
60
                        <textarea class="comment-textarea noedit"
61
                                  oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
62
                                  placeholder="Upravte komentář"></textarea>
63
                    </div>
77
                    }
78
                    else
79
                    {
80
                        <div class="action_buttons">
81
                            <span @onclick="UpdateComment"><i class="green fal fa-check"></i></span>
82
                            <span @onclick="DiscardComment"><i class="red fal fa-times"></i></span>
83
                        </div>
84
                    }
85
                </div>
86
            </div>
87
            @if (CommentEditId != comment.Id)
88
            {
89
                <div>@comment.Text</div>
90
            }
91
            else
92
            {
93
                <textarea class="comment-textarea noedit"
94
                          oninput='this.style.height = "";this.style.height = this.scrollHeight + "px"'
95
                          placeholder="Upravte komentář" @bind="CommentEditText"></textarea>
96
            }
97
        </div>
64 98
                }
65 99
            }
66 100
        </div>
......
82 116
    right: @(Show ? "0" : "-615")px;
83 117
</BlazorStyled.Styled>
84 118
<BlazorStyled.Styled>
119
    .action_buttons span {
120
    cursor: pointer;
121
    }
122
    .action_buttons span:hover {
123
    color:red;
124
    }
125
    .edit_goal_desc{
126
    left: calc(100% - 220px);
127
    margin: 0 0 20px 0;
128
    width: 200px;
129
    background: rgb(227, 6, 19);
130
    color: white;
131
    font-weight: 500;
132
    font-size: 14px;
133
    padding: 12px;
134
    border: none;
135
    border-radius: 4px;
136
    position: relative;
137
    cursor: pointer;
138
    }
85 139
    .goal_detail {
86 140
    width: 600px;
87 141
    height: 100%;
......
334 388

  
335 389
    private string CommentVisibility { get; set; } = "public";
336 390

  
391
    private Guid CommentEditId { get; set; } = default(Guid);
392

  
393
    private string CommentEditText { get; set; } = "";
337 394

  
338 395

  
339 396
    private Guid _detailId;
......
362 419

  
363 420
    public void CloseReview() => ReviewId = default(Guid);
364 421

  
422
    public void OpenCommentEdit(Guid id, string text) => (CommentEditId, CommentEditText) = (id, text);
423

  
424
    public void DeleteComment(Guid id)
425
    {
426

  
427
    }
428

  
429
    public void UpdateComment()
430
    {
431

  
432
    }
433

  
434
    public void DiscardComment() => (CommentEditId, CommentEditText) = (default(Guid), "");
435

  
365 436
    private async Task GetDetails()
366 437
    {
367 438
        var response = await _mediator.Send(new GetGoalById.Query(DetailId));
......
401 472
        {
402 473
            //toastService.ShowSuccess("Komentář úspěšně přidán");
403 474
            await GetDetails(); //Refresh
475
            CommentText = "";
476
            CommentVisibility = "public";
404 477
        }
405
        else toastService.ShowError($"Komentář se nepodařil opřidat {response.Errors.FirstOrDefault() ?? ""}");
478
        else toastService.ShowError($"Komentář se nepodařilo přidat {response.Errors.FirstOrDefault() ?? ""}");
406 479
    }
407 480

  
408 481
    private async Task Close()
src/Modules/Goal/Application/Leuze.Modules.Goal.Application.UI/_Imports.razor
35 35
@using Leuze.Modules.Goal.Domain.Domains
36 36
@using Leuze.Modules.Goal.Domain.Domains.DTOs
37 37
@using Microsoft.Extensions.Localization
38
@using Microsoft.AspNetCore.Localization
38
@using Microsoft.AspNetCore.Localization
39
@using Leuze.Core.Application.Authentication

Také k dispozici: Unified diff