chore(ux): add some notifications

This commit is contained in:
Romain Lanz
2017-09-03 15:46:40 +02:00
parent b92f0ffebd
commit 0442ee2c55
3 changed files with 24 additions and 4 deletions
+9 -3
View File
@@ -242,9 +242,11 @@ function OpenEmployeeList(society)
if data.value == 'fire' then
TriggerEvent('esx:showNotification', _U('you_have_fired', employee.name))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society)
end, employee.identifier, 'unemployed', 0)
end, employee.identifier, 'unemployed', 0, 'fire')
end
@@ -294,9 +296,11 @@ function OpenRecruitMenu(society)
if data2.current.value == 'yes' then
TriggerEvent('esx:showNotification', _U('you_have_hired', data.current.name))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenRecruitMenu(society)
end, data.current.identifier, society, 0)
end, data.current.identifier, society, 0, 'hire')
end
@@ -336,9 +340,11 @@ function OpenPromoteMenu(society, employee)
function(data, menu)
menu.close()
TriggerEvent('esx:showNotification', _U('you_have_promoted', employee.name, data.current.label))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society)
end, employee.identifier, society, data.current.value)
end, employee.identifier, society, data.current.value, promote)
end,
function(data, menu)
+6
View File
@@ -27,5 +27,11 @@ Locales['fr'] = {
['yes'] = 'oui',
['you_have'] = 'vous avez ~g~$',
['you_have_laundered'] = 'vous avez ~r~blanchi~s~ votre argent : ~g~$',
['you_have_hired'] = 'Vous avez recruté %s',
['you_have_been_hired'] = 'Vous avez été recruté dans la société %s',
['you_have_fired'] = 'Vous avez viré %s',
['you_have_been_fired'] = 'Vous avez été viré de la société %s',
['you_have_promoted'] = 'Vous avez promu %s en tant que %s',
['you_have_been_promoted'] = 'Vous avez été promu',
}
+9 -1
View File
@@ -149,10 +149,18 @@ ESX.RegisterServerCallback('esx_society:getJob', function(source, cb, society)
end)
ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier, job, grade)
ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier, job, grade, type)
local xPlayer = ESX.GetPlayerFromIdentifier(identifier)
if type == 'hire' then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_have_been_hired', job))
elseif type == 'promote' then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_have_been_promoted'))
elseif type == 'fire' then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_have_been_fired', xPlayer.getJob().label))
end
if xPlayer ~= nil then
xPlayer.setJob(job, grade)
end