From 04a10969b7e525f6d22af0d27c968b4c62e12b9d Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sat, 16 Dec 2023 11:49:11 +0100 Subject: [PATCH] fix: Fixed the problem that prevented the creation of invoices --- .github/CHANGELOG.md | 3 ++- .../[bpt_addons]/bpt_ammujob/client/main.lua | 19 ++++++++++--------- .../[bpt_addons]/bpt_ammujob/locales/en.lua | 5 ++++- .../[bpt_addons]/bpt_ammujob/locales/it.lua | 5 ++++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 0b3e862ba..48d424cea 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -75,4 +75,5 @@ fix lint error: unused argument last; accessing undefined variable Invoke; unuse 48. fix: No such export getSharedObject in resource es_extended @bitpredator 49. [bpt_bakerjob]: refactor: bpt_bakerjob inventory implementation @bitpredator 50. [bpt_ballasjob]: refactor: bpt_ballasjob inventory implementation @bitpredator -51. [bpt_ballasjob]: feat: bpt_ballasjob\locales\en.lua @bitpredator \ No newline at end of file +51. [bpt_ballasjob]: feat: bpt_ballasjob\locales\en.lua @bitpredator +52. [bpt_ammujob]: Fixed the problem that prevented the creation of invoices @bitpredator \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_ammujob/client/main.lua b/server-data/resources/[bpt_addons]/bpt_ammujob/client/main.lua index 25fa39902..dc48ea442 100644 --- a/server-data/resources/[bpt_addons]/bpt_ammujob/client/main.lua +++ b/server-data/resources/[bpt_addons]/bpt_ammujob/client/main.lua @@ -205,20 +205,23 @@ end function OpenMobileAmmuActionsMenu() local elements = { {unselectable = true, icon = "fas fa-ammu", title = _U('ammu')}, - {icon = "fas fa-scroll", title = _U('billing'), value = "billing"} + {icon = "fas fa-scroll", title = _U('billing'), value = "billing"}, } - ESX.OpenContext("right", elements, function(_,element) + ESX.OpenContext("right", elements, function(_, element) if element.value == "billing" then - ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', { - title = _U('invoice_amount') - }, function(data, menu) + local elements2 = { + {unselectable = true, icon = "fas fa-ammu", title = element.title}, + {title = _U('amount'), input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = _U('bill_amount')}, + {icon = "fas fa-check-double", title = _U('confirm'), value = "confirm"} + } - local amount = tonumber(data.value) + ESX.OpenContext("right", elements2, function(menu2) + local amount = tonumber(menu2.eles[2].inputValue) if amount == nil then ESX.ShowNotification(_U('amount_invalid')) else - menu.close() + ESX.CloseContext() local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() if closestPlayer == -1 or closestDistance > 3.0 then ESX.ShowNotification(_U('no_players_near')) @@ -228,8 +231,6 @@ function OpenMobileAmmuActionsMenu() ESX.ShowNotification(_U('billing_sent')) end end - end, function(_, menu) - menu.close() end) end end) diff --git a/server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua index 3cad3db87..d4274b6b4 100644 --- a/server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua +++ b/server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua @@ -27,5 +27,8 @@ Locales['en'] = { ['no_players_near'] = 'no players nearby', ['boss_actions'] = 'Boss actions', ['blip_ammu'] = 'Armory.', - ['ammu'] = 'ammu' + ['ammu'] = 'ammu', + -- billing + ['bill_amount'] = "Amount to bill..", + ['confirm'] = "Confirm" } \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua index 38f6a4436..542bef584 100644 --- a/server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua +++ b/server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua @@ -27,5 +27,8 @@ Locales['it'] = { ['no_players_near'] = 'nessun giocatore nelle vicinanze', ['boss_actions'] = 'Azioni del capo', ['blip_ammu'] = 'Armeria.', - ['ammu'] = 'ammu' + ['ammu'] = 'ammu', + -- billing + ['bill_amount'] = "importo della fattura", + ['confirm'] = "Conferma" } \ No newline at end of file