|
726 | 726 |
|
727 | 727 | <!-- ==== MAIN ==== --> |
728 | 728 | <main> |
| 729 | + <form id="approveForm" method="get" action="${pageContext.request.contextPath}/admin/approve-request"> |
| 730 | + <input type="hidden" name="account" id="approveAccount"> |
| 731 | + <input type="hidden" name="title" id="approveTitle"> |
| 732 | + <input type="hidden" name="cover" id="approveCover"> |
| 733 | + </form> |
| 734 | + |
| 735 | + <form id="rejectForm" method="get" action="${pageContext.request.contextPath}/admin/reject-request"> |
| 736 | + <input type="hidden" name="account" id="rejectAccount"> |
| 737 | + <input type="hidden" name="title" id="rejectTitle"> |
| 738 | + <input type="hidden" name="cover" id="approveCover"> |
| 739 | + </form> |
729 | 740 | <div class="page-title"> |
730 | 741 | <h2>Manage Extend Requests</h2> |
731 | 742 | </div> |
|
774 | 785 |
|
775 | 786 | <td> |
776 | 787 | <c:choose> |
777 | | - <c:when test="${r.status == 'PENDING'}"> |
| 788 | + <c:when test="${r.status == 'pending'}"> |
778 | 789 | <span class="status-badge status-inactive"> |
779 | 790 | <i class="fa-solid fa-hourglass-half"></i> Pending |
780 | 791 | </span> |
781 | 792 | </c:when> |
782 | | - <c:when test="${r.status == 'APPROVED'}"> |
| 793 | + <c:when test="${r.status == 'approved'}"> |
783 | 794 | <span class="status-badge status-active"> |
784 | 795 | <i class="fa-solid fa-circle-check"></i> Approved |
785 | 796 | </span> |
|
791 | 802 | </c:otherwise> |
792 | 803 | </c:choose> |
793 | 804 | </td> |
794 | | - <td> |
| 805 | + <td> |
795 | 806 | <div class="actions"> |
796 | | - <button class="btn btn-success btn-sm" onclick="approveRequest('${r.account}', '${r.title}')"> |
| 807 | + <button class="btn btn-success btn-sm" onclick="approveRequest('${r.account}', '${r.title}', '${r.coverImage}')"> |
797 | 808 | <i class="fa-solid fa-check"></i> Approve |
798 | 809 | </button> |
799 | 810 | <button class="btn btn-danger btn-sm" onclick="rejectRequest('${r.account}', '${r.title}')"> |
|
826 | 837 | window.location.href = '${pageContext.request.contextPath}/admin/extend-request-manger?search=' + encodeURIComponent(val); |
827 | 838 | } |
828 | 839 |
|
829 | | - function approveRequest(account, title) { |
| 840 | + function approveRequest(account, title, cover) { |
830 | 841 | if (confirm(`Approve extend request for "${title}" by ${account}?`)) { |
831 | | - alert("Approved (demo)"); |
832 | | - // TODO: gọi servlet xử lý POST approve |
| 842 | + document.getElementById("approveAccount").value = account; |
| 843 | + document.getElementById("approveTitle").value = title; |
| 844 | + document.getElementById("approveCover").value = cover; |
| 845 | + document.getElementById("approveForm").submit(); |
833 | 846 | } |
834 | 847 | } |
835 | 848 |
|
836 | | - function rejectRequest(account, title) { |
| 849 | + function rejectRequest(account, title, cover) { |
837 | 850 | if (confirm(`Reject extend request for "${title}" by ${account}?`)) { |
838 | | - alert("Rejected (demo)"); |
839 | | - // TODO: gọi servlet xử lý POST reject |
| 851 | + document.getElementById("rejectAccount").value = account; |
| 852 | + document.getElementById("rejectTitle").value = title; |
| 853 | + document.getElementById("approveCover").value = cover; |
| 854 | + document.getElementById("rejectForm").submit(); |
840 | 855 | } |
841 | 856 | } |
| 857 | +
|
842 | 858 | </script> |
843 | 859 | </body> |
844 | 860 |
|
|
0 commit comments