fix: add join agency cancel action
This commit is contained in:
parent
72031c5b08
commit
d72a0502ec
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||||
<title>Host Center</title>
|
<title>Host Center</title>
|
||||||
<link rel="stylesheet" href="./style.css?v=20260428-2110" />
|
<link rel="stylesheet" href="./style.css?v=20260428-2120" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="host-center" aria-label="Host Center" data-i18n-aria="page_label" data-loading="true" data-view="loading">
|
<div class="host-center" aria-label="Host Center" data-i18n-aria="page_label" data-loading="true" data-view="loading">
|
||||||
@ -175,6 +175,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="join-agency-pending-note" data-i18n="join_pending_note">Application is pending. Please wait for agency approval.</p>
|
<p class="join-agency-pending-note" data-i18n="join_pending_note">Application is pending. Please wait for agency approval.</p>
|
||||||
|
<button class="join-agency-cancel-button" id="joinAgencyCancelButton" type="button" data-i18n="cancel">Cancel</button>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -194,6 +195,6 @@
|
|||||||
<div class="loading-copy">loading....</div>
|
<div class="loading-copy">loading....</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="./script.js?v=20260428-2110" defer></script>
|
<script src="./script.js?v=20260428-2120" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -43,6 +43,10 @@
|
|||||||
application_records: "Application Records",
|
application_records: "Application Records",
|
||||||
pending: "Pending",
|
pending: "Pending",
|
||||||
join_pending_note: "Application is pending. Please wait for agency approval.",
|
join_pending_note: "Application is pending. Please wait for agency approval.",
|
||||||
|
cancel: "Cancel",
|
||||||
|
cancelling: "Cancelling...",
|
||||||
|
cancellation_failed: "Cancellation failed",
|
||||||
|
application_cancelled: "Application cancelled",
|
||||||
missing_token: "Missing token",
|
missing_token: "Missing token",
|
||||||
network_error: "Network error. Please try again.",
|
network_error: "Network error. Please try again.",
|
||||||
withdraw_exchange: "Withdraw/Exchange",
|
withdraw_exchange: "Withdraw/Exchange",
|
||||||
@ -95,6 +99,10 @@
|
|||||||
application_records: "سجلات الطلب",
|
application_records: "سجلات الطلب",
|
||||||
pending: "قيد الانتظار",
|
pending: "قيد الانتظار",
|
||||||
join_pending_note: "الطلب قيد الانتظار. يرجى انتظار موافقة الوكالة.",
|
join_pending_note: "الطلب قيد الانتظار. يرجى انتظار موافقة الوكالة.",
|
||||||
|
cancel: "إلغاء",
|
||||||
|
cancelling: "جار الإلغاء...",
|
||||||
|
cancellation_failed: "فشل الإلغاء",
|
||||||
|
application_cancelled: "تم إلغاء الطلب",
|
||||||
missing_token: "رمز الدخول مفقود",
|
missing_token: "رمز الدخول مفقود",
|
||||||
network_error: "خطأ في الشبكة. حاول مرة أخرى.",
|
network_error: "خطأ في الشبكة. حاول مرة أخرى.",
|
||||||
withdraw_exchange: "سحب/استبدال",
|
withdraw_exchange: "سحب/استبدال",
|
||||||
@ -147,6 +155,10 @@
|
|||||||
application_records: "Başvuru Kayıtları",
|
application_records: "Başvuru Kayıtları",
|
||||||
pending: "Beklemede",
|
pending: "Beklemede",
|
||||||
join_pending_note: "Başvuru beklemede. Lütfen ajans onayını bekleyin.",
|
join_pending_note: "Başvuru beklemede. Lütfen ajans onayını bekleyin.",
|
||||||
|
cancel: "İptal",
|
||||||
|
cancelling: "İptal ediliyor...",
|
||||||
|
cancellation_failed: "İptal başarısız",
|
||||||
|
application_cancelled: "Başvuru iptal edildi",
|
||||||
missing_token: "Token eksik",
|
missing_token: "Token eksik",
|
||||||
network_error: "Ağ hatası. Lütfen tekrar deneyin.",
|
network_error: "Ağ hatası. Lütfen tekrar deneyin.",
|
||||||
withdraw_exchange: "Çek/Değiştir",
|
withdraw_exchange: "Çek/Değiştir",
|
||||||
@ -199,6 +211,10 @@
|
|||||||
application_records: "Catatan Pengajuan",
|
application_records: "Catatan Pengajuan",
|
||||||
pending: "Menunggu",
|
pending: "Menunggu",
|
||||||
join_pending_note: "Pengajuan sedang menunggu. Harap tunggu persetujuan agensi.",
|
join_pending_note: "Pengajuan sedang menunggu. Harap tunggu persetujuan agensi.",
|
||||||
|
cancel: "Batal",
|
||||||
|
cancelling: "Membatalkan...",
|
||||||
|
cancellation_failed: "Gagal membatalkan",
|
||||||
|
application_cancelled: "Pengajuan dibatalkan",
|
||||||
missing_token: "Token tidak ditemukan",
|
missing_token: "Token tidak ditemukan",
|
||||||
network_error: "Kesalahan jaringan. Silakan coba lagi.",
|
network_error: "Kesalahan jaringan. Silakan coba lagi.",
|
||||||
withdraw_exchange: "Tarik/Tukar",
|
withdraw_exchange: "Tarik/Tukar",
|
||||||
@ -802,6 +818,13 @@
|
|||||||
function syncJoinAgencyApplyAvailability() {
|
function syncJoinAgencyApplyAvailability() {
|
||||||
const button = document.querySelector("#joinAgencyApplyButton");
|
const button = document.querySelector("#joinAgencyApplyButton");
|
||||||
if (button) button.hidden = Boolean(pendingJoinRecord) || !foundJoinAgency?.id;
|
if (button) button.hidden = Boolean(pendingJoinRecord) || !foundJoinAgency?.id;
|
||||||
|
|
||||||
|
const cancelButton = document.querySelector("#joinAgencyCancelButton");
|
||||||
|
if (cancelButton) cancelButton.hidden = !pendingJoinRecord || !pickPendingJoinRecordId(pendingJoinRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pickPendingJoinRecordId(record) {
|
||||||
|
return record?.messageId || record?.id || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFoundJoinAgency(profile = foundJoinAgency) {
|
function renderFoundJoinAgency(profile = foundJoinAgency) {
|
||||||
@ -941,6 +964,37 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function cancelJoinApplication() {
|
||||||
|
const id = pickPendingJoinRecordId(pendingJoinRecord);
|
||||||
|
if (!id) return;
|
||||||
|
|
||||||
|
const button = document.querySelector("#joinAgencyCancelButton");
|
||||||
|
if (button) {
|
||||||
|
button.disabled = true;
|
||||||
|
button.textContent = message("cancelling");
|
||||||
|
}
|
||||||
|
showJoinAgencyStatus("");
|
||||||
|
|
||||||
|
try {
|
||||||
|
await requestJSON("/team/user/join-apply-cancel", {
|
||||||
|
method: "POST",
|
||||||
|
body: { id }
|
||||||
|
});
|
||||||
|
|
||||||
|
pendingJoinRecord = null;
|
||||||
|
renderPendingJoinRecord(null);
|
||||||
|
showJoinAgencyStatus(message("application_cancelled"), "success");
|
||||||
|
} catch (error) {
|
||||||
|
showJoinAgencyStatus(joinAgencyErrorMessage(error, "cancellation_failed"), "error");
|
||||||
|
} finally {
|
||||||
|
if (button) {
|
||||||
|
button.disabled = false;
|
||||||
|
button.textContent = message("cancel");
|
||||||
|
}
|
||||||
|
syncJoinAgencyApplyAvailability();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setJoinAgencyModalOpen(open) {
|
function setJoinAgencyModalOpen(open) {
|
||||||
const modal = document.querySelector("#joinAgencyModal");
|
const modal = document.querySelector("#joinAgencyModal");
|
||||||
if (!modal) return;
|
if (!modal) return;
|
||||||
@ -1238,6 +1292,10 @@
|
|||||||
applyToJoinAgency();
|
applyToJoinAgency();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelector("#joinAgencyCancelButton")?.addEventListener("click", () => {
|
||||||
|
cancelJoinApplication();
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll("[data-close-join-agency]").forEach((node) => {
|
document.querySelectorAll("[data-close-join-agency]").forEach((node) => {
|
||||||
node.addEventListener("click", () => {
|
node.addEventListener("click", () => {
|
||||||
setJoinAgencyModalOpen(false);
|
setJoinAgencyModalOpen(false);
|
||||||
|
|||||||
@ -1213,7 +1213,8 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.join-agency-search-button,
|
.join-agency-search-button,
|
||||||
.join-agency-apply-button {
|
.join-agency-apply-button,
|
||||||
|
.join-agency-cancel-button {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -1231,7 +1232,8 @@ a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.join-agency-search-button:disabled,
|
.join-agency-search-button:disabled,
|
||||||
.join-agency-apply-button:disabled {
|
.join-agency-apply-button:disabled,
|
||||||
|
.join-agency-cancel-button:disabled {
|
||||||
opacity: 0.58;
|
opacity: 0.58;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,6 +1326,13 @@ a {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.join-agency-cancel-button {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #e9edf0;
|
||||||
|
background: #fff;
|
||||||
|
color: #4b4e55;
|
||||||
|
}
|
||||||
|
|
||||||
.join-agency-pending-head {
|
.join-agency-pending-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user