沙世明
2023-03-09 99b667bdfd8d4fd4d56c2952510169d7f7be794c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
    <div>
        <lightning-card>
            <h3 slot="title">
                <lightning-icon
                  icon-name="standard:approval"
                  size="small"
                ></lightning-icon>
                <a
                  class="slds-card__header-link slds-p-left_medium"
                  if:true={approvalHistory}
                  >Approval History ({approvalHistory.approvalStepsSize})</a
                >
              </h3>
              <div slot="actions" if:true={approvalHistory}>
                <lightning-button
                  data-id="SubmitForApproval"
                  label="Submit for Approval"
                  if:true={showSubmitForApprovalButton}
                  onclick={handleSubmitForApprovalClick}
                ></lightning-button>
                <lightning-button
                  data-id="Approve"
                  label="Approve"
                  if:true={approvalHistory.isCurrentUserApprover}
                  onclick={handleApproveClick}
                ></lightning-button>
                <lightning-button
                  data-id="Reject"
                  label="Reject"
                  if:true={approvalHistory.isCurrentUserApprover}
                  onclick={handleRejectClick}
                ></lightning-button>
                <lightning-button-menu
                  alternative-text="Show menu"
                  if:true={showButtonMenu}
                >
                  <lightning-menu-item
                    data-id="Reassign"
                    value="Reassign"
                    label="Reassign"
                    if:true={approvalHistory.isCurrentUserApprover}
                    onclick={handleReassignClick}
                  ></lightning-menu-item>
                  <lightning-menu-item
                    data-id="Recall"
                    value="Recall"
                    label="Recall"
                    if:true={approvalHistory.showRecall}
                    onclick={handleRecallClick}
                  ></lightning-menu-item>
                </lightning-button-menu>
              </div>
              <template if:true={showDataTable}>
                <lightning-datatable
                  key-field="id"
                  data={approvalHistory.approvalSteps}
                  columns={columns}
                  hide-checkbox-column
                  class="myApprovalHistoryTable"
                ></lightning-datatable>
                
              </template>
              <template if:true={showDataTable}>
                <!-- needed to use the footer class because the tob bar looked weird with the datatable component on top-->
                <center>
                  <p  class="slds-p-around_large">
                    <lightning-formatted-url
                      value={viewAllUrl}
                      label="View All"
                    ></lightning-formatted-url>
                  </p>  
                </center>
                
              </template>
                              
        
              <c-modal data-id="submitForApproval" onclosedialog={handleModalCancel}> 
                <div slot="header">{modalTitle}</div>
                <div class="slds-form-element" if:true={showCommentModal}>
                  <lightning-input
                    data-id="comment"
                    type="text"
                    label="Comments"
                    value=""
                  ></lightning-input>
                </div>
                <div class="slds-form-element lookup-form" if:true={showLookupModal}>
                  <c-lookup
                    errors={lookupErrors}
                    onsearch={handleLookupSearch}
                    onselectionchange={handleSelectionChange}
                    label={lookupLabel}
                    placeholder="Search Users..."
                    is-multi-entry={isMultiEntry}
                    required
                  >
                  </c-lookup>
                </div>
                <div slot="footer">
                  <lightning-button
                    data-id="Cancel"
                    label="Cancel"
                    onclick={handleModalCancel}
                  ></lightning-button>
                  <lightning-button
                    data-id="Submit"
                    label={modalsubmitLabel}
                    variant="brand"
                    class="slds-p-left_small"
                    onclick={handleModalSubmit}
                  ></lightning-button>
                </div>
              </c-modal> 
          </lightning-card>
      </div>
</template>