diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-26 17:23:28 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-10-26 17:23:28 +0100 |
| commit | 60488d722bf29f3ff0ce3e08b90f30523a8d7b6d (patch) | |
| tree | c2e01243d8a0d970c35e250b66a66a226ab230dc /src/ui/ui_expenses.cpp | |
| parent | 5e06ad208e32330b662af90ce41613f5421095cb (diff) | |
loading animations and block navigation while writing to disk
Diffstat (limited to 'src/ui/ui_expenses.cpp')
| -rw-r--r-- | src/ui/ui_expenses.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/ui/ui_expenses.cpp b/src/ui/ui_expenses.cpp index d1121b1..8635273 100644 --- a/src/ui/ui_expenses.cpp +++ b/src/ui/ui_expenses.cpp @@ -294,11 +294,17 @@ static void draw_expenses_list() } } +static void _reset_to_default_view() +{ + current_view_state = ui::view_state::LIST_ALL; + ui::destroy_expenses(); + ui::setup_expenses(); +} static void draw_expense_update() { - if (ImGui::Button(locale::get("form.back"))) { - current_view_state = ui::view_state::LIST_ALL; + if (ImGui::Button(locale::get("form.back"), true, false)) { + _reset_to_default_view(); } draw_expense_form(&active_invoice); @@ -307,13 +313,9 @@ static void draw_expense_update() if (!can_save) ImGui::BeginDisabled(); ImGui::Spacing(); - if (ImGui::Button(locale::get("form.save"))) { + if (ImGui::Button(locale::get("form.save"), true)) { + administration_writer::set_write_completed_event_callback(_reset_to_default_view); administration::invoice_update(&active_invoice); - - current_view_state = ui::view_state::LIST_ALL; - - ui::destroy_expenses(); - ui::setup_expenses(); } if (!can_save) ImGui::EndDisabled(); @@ -321,8 +323,8 @@ static void draw_expense_update() static void draw_expense_create() { - if (ImGui::Button(locale::get("form.back"))) { - current_view_state = ui::view_state::LIST_ALL; + if (ImGui::Button(locale::get("form.back"), true, false)) { + _reset_to_default_view(); } draw_expense_form(&active_invoice); @@ -331,13 +333,9 @@ static void draw_expense_create() if (!can_save) ImGui::BeginDisabled(); ImGui::Spacing(); - if (ImGui::Button(locale::get("form.save"))) { + if (ImGui::Button(locale::get("form.save"), true)) { + administration_writer::set_write_completed_event_callback(_reset_to_default_view); administration::invoice_add(&active_invoice); - - current_view_state = ui::view_state::LIST_ALL; - - ui::destroy_expenses(); - ui::setup_expenses(); } if (!can_save) ImGui::EndDisabled(); @@ -345,8 +343,8 @@ static void draw_expense_create() static void draw_expense_view() { - if (ImGui::Button(locale::get("form.back"))) { - current_view_state = ui::view_state::LIST_ALL; + if (ImGui::Button(locale::get("form.back"), true, false)) { + _reset_to_default_view(); } draw_expense_form(&active_invoice, true); @@ -365,7 +363,7 @@ static void draw_import_request() } else { if (ImGui::Button(locale::get("form.back"))) { - current_view_state = ui::view_state::LIST_ALL; + _reset_to_default_view(); active_import_request = 0; return; } |
