From fafacbefc3e8ce884b65c3d99a3d5ffb608c2b35 Mon Sep 17 00:00:00 2001 From: ajdj100 Date: Fri, 16 Jan 2026 19:17:43 -0500 Subject: [PATCH] Wrapped up approval visuals and refresh behaviour --- api/src/services/db/rankService.ts | 6 ++++-- shared/types/rank.ts | 2 ++ ui/src/components/promotions/promotionForm.vue | 5 +++++ ui/src/components/promotions/promotionList.vue | 14 +++++++++++++- .../components/promotions/promotionListDay.vue | 17 +++++++++++++++-- ui/src/pages/RankChange.vue | 13 ++++++++----- 6 files changed, 47 insertions(+), 10 deletions(-) diff --git a/api/src/services/db/rankService.ts b/api/src/services/db/rankService.ts index 193a197..4bffdde 100644 --- a/api/src/services/db/rankService.ts +++ b/api/src/services/db/rankService.ts @@ -40,7 +40,7 @@ export async function batchInsertMemberRank(promos: BatchPromotionMember[], auth try { var con = await pool.getConnection(); promos.forEach(p => { - con.query(`CALL sp_update_member_rank(?, ?, ?, ?, ?, ?)`, [p.member_id, p.rank_id, author, approver, "Rank Change", toDateIgnoreZone(new Date(p.start_date))]) + con.query(`CALL sp_update_member_rank(?, ?, ?, ?, ?, ?)`, [p.member_id, p.rank_id, approver, author, "Rank Change", toDateIgnoreZone(new Date(p.start_date))]) }); con.commit(); @@ -91,8 +91,10 @@ export async function getPromotionsOnDay(day: Date): Promise // SQL query to fetch all records from members_unit for the specified day let sql = ` SELECT - mr.member_id, + mr.id AS promo_id, + mr.member_id, mr.created_by_id, + mr.authorized_by_id, r.short_name FROM members_ranks AS mr LEFT JOIN ranks AS r ON r.id = mr.rank_id diff --git a/shared/types/rank.ts b/shared/types/rank.ts index 6ec4f3a..91899b1 100644 --- a/shared/types/rank.ts +++ b/shared/types/rank.ts @@ -11,7 +11,9 @@ export interface PromotionSummary { } export interface PromotionDetails { + promo_id: number; member_id: number; short_name: string; created_by_id: number; + authorized_by_id: number; } \ No newline at end of file diff --git a/ui/src/components/promotions/promotionForm.vue b/ui/src/components/promotions/promotionForm.vue index c529a37..a6708f6 100644 --- a/ui/src/components/promotions/promotionForm.vue +++ b/ui/src/components/promotions/promotionForm.vue @@ -38,6 +38,7 @@ const submitForm = handleSubmit( output.promotions.map(p => p.start_date = new Date(p.start_date).toISOString()) await submitRankChange(output); formSubmitted.value = true; + emit("submitted"); } catch (error) { submitError.value = error; console.error(error); @@ -45,6 +46,10 @@ const submitForm = handleSubmit( } ); +const emit = defineEmits<{ + submitted: [void] +}>(); + const submitError = ref(null); const formSubmitted = ref(false); diff --git a/ui/src/components/promotions/promotionList.vue b/ui/src/components/promotions/promotionList.vue index d67c859..66553c1 100644 --- a/ui/src/components/promotions/promotionList.vue +++ b/ui/src/components/promotions/promotionList.vue @@ -40,6 +40,17 @@ async function loadHistory() { pageData.value = d.pagination; } +function refresh() { + loadHistory(); + promoDayDetails.value?.[0].loadData(); +} + +defineExpose({ + refresh +}) + +const promoDayDetails = ref[]>(null) + const expanded = ref(null); const hoverID = ref(null); @@ -107,7 +118,8 @@ function formatDate(date: Date): string { :class="{ 'bg-muted/50 border-t-0': hoverID === index }">
- + +
diff --git a/ui/src/components/promotions/promotionListDay.vue b/ui/src/components/promotions/promotionListDay.vue index 3e4dc36..05df71e 100644 --- a/ui/src/components/promotions/promotionListDay.vue +++ b/ui/src/components/promotions/promotionListDay.vue @@ -13,8 +13,17 @@ const props = defineProps<{ const promoList = ref(); const loading = ref(true); -onMounted(async () => { +async function loadData() { promoList.value = await getPromotionsOnDay(props.date); +} + +defineExpose({ + loadData +}) + +onMounted(async () => { + // promoList.value = await getPromotionsOnDay(props.date); + await loadData(); loading.value = false; }) @@ -27,7 +36,8 @@ onMounted(async () => { Member Rank - Approved By + Approved By + Submitted By @@ -39,6 +49,9 @@ onMounted(async () => { {{ p.short_name }} + + + diff --git a/ui/src/pages/RankChange.vue b/ui/src/pages/RankChange.vue index 5df78c7..5caf61c 100644 --- a/ui/src/pages/RankChange.vue +++ b/ui/src/pages/RankChange.vue @@ -1,21 +1,24 @@