Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit ab0e071

Browse files
authored
Merge pull request #61 from topcoder-platform/reskin-payment
Reskin payment improvements
2 parents 3449a12 + 5df681d commit ab0e071

File tree

3 files changed

+106
-3
lines changed

3 files changed

+106
-3
lines changed

src/main/com/topcoder/web/tc/controller/legacy/pacts/controller/request/member/PaymentHistory.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public class PaymentHistory extends BaseProcessor implements PactsConstants {
6363
public static final String XLS_FORMAT = "xls";
6464
public static final String FULL_LIST = "full_list";
6565
public static final String PAYMENTS = "payments";
66+
public static final String OWED_PAYMENTS = "owedPayments";
67+
public static final String TOTAL_OWED_PAYMENTS = "totalOwedPayments";
6668

6769
/**
6870
* <p>A <code>String</code> providing the name for request attribute holding the ID of a payment method preferred by
@@ -150,9 +152,17 @@ protected void businessProcessing() throws TCWebException {
150152

151153
List<BasePayment> removeNonPending = new ArrayList<BasePayment>();
152154

155+
List<Long> owedPayments = new ArrayList<Long>();
156+
double totalOwedPayments = 0.0;
157+
Date currentDate = new Date();
158+
153159
for (BasePayment payment : payments) {
154160
if (payment.getPaymentType() == 3 || payment.getPaymentType() == 5) {
155161
removePayments.add(payment);
162+
} else if ((payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) &&
163+
!(payment.getDueDate().after(currentDate))) {
164+
owedPayments.add(payment.getId());
165+
totalOwedPayments += payment.getNetAmount();
156166
} else {
157167
if (!(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.OWED_PAYMENT_STATUS))) &&
158168
!(payment.getCurrentStatus().equals(PaymentStatusFactory.createStatus(PaymentStatus.ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS))) &&
@@ -184,6 +194,8 @@ protected void businessProcessing() throws TCWebException {
184194
getRequest().setAttribute("NUM_TOTAL", payments.size());
185195
getRequest().setAttribute("NUM_PER_PAGE", numRecords);
186196
getRequest().setAttribute("NUM_PENDING", pendingPayments);
197+
getRequest().setAttribute("OWED_PAYMENTS", owedPayments);
198+
getRequest().setAttribute("TOTAL_OWED_PAYMENTS", totalOwedPayments);
187199

188200
if (exportToExcel) {
189201
produceXLS(payments);

src/main/com/topcoder/web/tc/view/pacts/client/PaymentHistory.jsp

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
<c:set value="<%=request.getAttribute("NUM_TOTAL")%>" var="numTotal" />
5757
<c:set value="<%=request.getAttribute("NUM_PER_PAGE")%>" var="numPerPage" />
5858
<c:set value="<%=request.getAttribute("NUM_PENDING")%>" var="numPending" />
59+
<c:set value="<%=request.getAttribute("OWED_PAYMENTS")%>" var="owedPayments" />
60+
<c:set value="<%=request.getAttribute("TOTAL_OWED_PAYMENTS")%>" var="totalOwedPayments" />
5961
<c:set value="<%=DataAccessConstants.SORT_COLUMN%>" var="sortColumn"/>
6062
<c:set value="<%=DataAccessConstants.SORT_DIRECTION%>" var="sortDirection"/>
6163

@@ -81,6 +83,9 @@
8183
MINIMUM_PAYMENT_ACCRUAL_AMOUNT = ${MINIMUM_PAYMENT_ACCRUAL_AMOUNT};
8284
PAY_ME_CONFIRMATION_TEMPLATE = '${paymentConfirmationTemplate}';
8385
86+
var owedPayments = ${owedPayments};
87+
var totalOwedPayments = ${totalOwedPayments};
88+
8489
function next() {
8590
var myForm = document.f;
8691
myForm.<%=DataAccessConstants.START_RANK%>.value = ${requestScope[defaults][startRank]} + parseInt(myForm.<%=DataAccessConstants.NUMBER_RECORDS%>.value);
@@ -139,6 +144,23 @@
139144
$('.payable[value="' + paymentId + '"]').click();
140145
});
141146
147+
$('.checkAll').click(function () {
148+
if (this.checked) {
149+
$('.checkAll').attr('checked', true);
150+
$('.payable').each(function () {
151+
var paymentId = this.value;
152+
$('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').removeClass('checked');
153+
$('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').addClass('checked');
154+
});
155+
} else {
156+
$('.checkAll').attr('checked', false);
157+
$('.payable').each(function () {
158+
var paymentId = this.value;
159+
$('[data-name="${PAYMENT_ID}"][data-value="'+paymentId+'"]').removeClass('checked');
160+
});
161+
}
162+
});
163+
142164
$('.payable').click(function() {
143165
var hasSelected = false;
144166
$('.payable:checked').each(function () {
@@ -151,6 +173,11 @@
151173
error = $('<span />').attr('class', 'bigRed').html('The total net amount for selected payments is less than $25');
152174
$("#PaymentHistoryForm").prev().append('<br>').append(error)
153175
}
176+
if ($('.checkable:checked').length == $('.checkable').length) {
177+
$('.checkAll').attr('checked', true);
178+
} else if ($('.checkable').not(':checked').length == $('.checkable').length) {
179+
$('.checkAll').attr('checked', false);
180+
}
154181
});
155182
});
156183
}
@@ -224,6 +251,12 @@
224251
</c:if>
225252

226253
<c:if test="${isReskin}">
254+
<div class="above-tabs">
255+
<div align="right" class="pay-me-btn">
256+
<input type="button" value="Pay Me" id="quickPayMe"/>
257+
</div>
258+
</div>
259+
227260
<%-- desktop tabs --%>
228261
<nav class="tabs paymentHistoryTabs">
229262
<c:if test="${fullList}" >
@@ -285,6 +318,15 @@
285318
}
286319
</script>
287320
</div>
321+
<%-- Mobile select all checkbox --%>
322+
<c:if test="${not empty payments}">
323+
<div class="mobile-select-all-checkbox">
324+
<span class="checkbox">
325+
<input type="checkbox" class="checkAll">
326+
<span class="checkbox-label"></span>
327+
</span>
328+
</div>
329+
</c:if>
288330
<%-- Mobile sort-button --%>
289331
<c:if test="${not empty payments}">
290332
<a
@@ -377,7 +419,13 @@
377419
<a class="getable" href="<%=sessionInfo.getServletPath()%>?<tc-webtag:sort column="7" includeParams="true" />" >Date Paid</a>
378420
<%--</c:if>--%>
379421
</td>
380-
<td class="header">&nbsp;</td>
422+
<td class="headerC">
423+
<span class="checkbox">
424+
<input type="checkbox" class="checkAll">
425+
<span class="checkbox-label"></span>
426+
</span>
427+
</td>
428+
<%-- <td class="header">&nbsp;</td> --%>
381429
</tr>
382430

383431
<c:forEach items="${payments}" var="payment">
@@ -424,7 +472,22 @@
424472
<td class="value type">${payment.paymentTypeDesc}</td>
425473
<td class="valueC create-date"><fmt:formatDate value="${payment.createDate}" pattern="dd/MM/yyyy"/></td>
426474
<td class="valueR net-payment"><fmt:formatNumber value="${payment.netAmount}" type="currency" currencySymbol="$"/></td>
427-
<td class="value status"><span class="status ${payment.currentStatus.desc}"><span class="status-label">${payment.currentStatus.desc}</span></span>
475+
<td class="value status">
476+
<span class="status ${payment.currentStatus.desc}">
477+
<span class="status-label">
478+
<c:choose>
479+
<c:when test="${payment.currentStatus.id eq OWED}">
480+
Available
481+
</c:when>
482+
<c:when test="${payment.currentStatus.id eq ACCRUING}">
483+
Pending
484+
</c:when>
485+
<c:otherwise>
486+
${payment.currentStatus.desc}
487+
</c:otherwise>
488+
</c:choose>
489+
</span>
490+
</span>
428491
<c:forEach items="${payment.currentStatus.reasons}" var="reason">
429492
<br>- ${reason.desc}
430493
</c:forEach>
@@ -448,6 +511,10 @@
448511
<c:when test="${payment.currentStatus.id eq OWED or payment.currentStatus.id eq ACCRUING}">
449512
<%-- Owed, Accruing --%>
450513
<c:choose>
514+
<c:when test="${payment.currentStatus.id eq ACCRUING}">
515+
<%-- Payment is pending yet: un-checked, disabled --%>
516+
<input type="checkbox" disabled="disabled" name="${PAYMENT_ID}" value="${payment.id}"/>
517+
</c:when>
451518
<c:when test="${payment.dueDate eq null or (payment.dueDate > now)}">
452519
<%-- Payment release date is not reached yet: un-checked, disabled --%>
453520
<input type="checkbox" disabled="disabled" name="${PAYMENT_ID}" value="${payment.id}"/>
@@ -550,7 +617,21 @@
550617
<div class="row status">
551618
<div class="col col-label">Status</div>
552619
<div class="col col-value">
553-
<span class="status ${paymentItem.currentStatus.desc}"><span class="status-label">${paymentItem.currentStatus.desc}</span></span>
620+
<span class="status ${paymentItem.currentStatus.desc}">
621+
<span class="status-label">
622+
<c:choose>
623+
<c:when test="${paymentItem.currentStatus.id eq OWED}">
624+
Available
625+
</c:when>
626+
<c:when test="${paymentItem.currentStatus.id eq ACCRUING}">
627+
Pending
628+
</c:when>
629+
<c:otherwise>
630+
${paymentItem.currentStatus.desc}
631+
</c:otherwise>
632+
</c:choose>
633+
</span>
634+
</span>
554635
<c:forEach items="${paymentItem.currentStatus.reasons}" var="reason">
555636
<br>- ${reason.desc}
556637
</c:forEach>
@@ -583,6 +664,10 @@
583664
<c:when test="${paymentItem.currentStatus.id eq OWED or paymentItem.currentStatus.id eq ACCRUING}">
584665
<%-- Owed, Accruing --%>
585666
<c:choose>
667+
<c:when test="${paymentItem.currentStatus.id eq ACCRUING}">
668+
<%-- Payment is pending yet: un-checked, disabled --%>
669+
<span role="checkbox" class="checkbox disabled" data-name="${PAYMENT_ID}" data-value="${paymentItem.id}"></span>
670+
</c:when>
586671
<c:when test="${paymentItem.dueDate eq null or (paymentItem.dueDate > now)}">
587672
<%-- Payment release date is not reached yet: un-checked, disabled --%>
588673
<span role="checkbox" class="checkbox disabled" data-name="${PAYMENT_ID}" data-value="${paymentItem.id}"></span>

src/main/com/topcoder/web/tc/view/pacts/client/PaymentStatusSummary.jsp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@
175175
<rsc:iterator list="<%=rsc%>" id="resultRow">
176176
<tr class="<%=even?"dark":"light"%>">
177177
<TD class="value payment-status">
178+
<% if ("Owed".equals(resultRow.getStringItem("payment_status"))) { %>
179+
Available
180+
<% } else if ("Accruing".equals(resultRow.getStringItem("payment_status"))) { %>
181+
Pending
182+
<% } else { %>
178183
<rsc:item name="payment_status" row="<%=resultRow%>"/>
184+
<% } %>
179185
</TD>
180186
<TD class="valueR net-amount">
181187
<% if (resultRow.getDoubleItem("net_amount") > 0) {

0 commit comments

Comments
 (0)