Merge pull request #5 from RomainForks/master

chore(ux): add some notifications
This commit is contained in:
Jérémie N'gadi
2017-09-03 16:40:43 +02:00
committed by GitHub
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 if data.value == 'fire' then
TriggerEvent('esx:showNotification', _U('you_have_fired', employee.name))
ESX.TriggerServerCallback('esx_society:setJob', function() ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society) OpenEmployeeList(society)
end, employee.identifier, 'unemployed', 0) end, employee.identifier, 'unemployed', 0, 'fire')
end end
@@ -294,9 +296,11 @@ function OpenRecruitMenu(society)
if data2.current.value == 'yes' then if data2.current.value == 'yes' then
TriggerEvent('esx:showNotification', _U('you_have_hired', data.current.name))
ESX.TriggerServerCallback('esx_society:setJob', function() ESX.TriggerServerCallback('esx_society:setJob', function()
OpenRecruitMenu(society) OpenRecruitMenu(society)
end, data.current.identifier, society, 0) end, data.current.identifier, society, 0, 'hire')
end end
@@ -336,9 +340,11 @@ function OpenPromoteMenu(society, employee)
function(data, menu) function(data, menu)
menu.close() menu.close()
TriggerEvent('esx:showNotification', _U('you_have_promoted', employee.name, data.current.label))
ESX.TriggerServerCallback('esx_society:setJob', function() ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society) OpenEmployeeList(society)
end, employee.identifier, society, data.current.value) end, employee.identifier, society, data.current.value, promote)
end, end,
function(data, menu) function(data, menu)
+6
View File
@@ -27,5 +27,11 @@ Locales['fr'] = {
['yes'] = 'oui', ['yes'] = 'oui',
['you_have'] = 'vous avez ~g~$', ['you_have'] = 'vous avez ~g~$',
['you_have_laundered'] = 'vous avez ~r~blanchi~s~ votre argent : ~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) 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) 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 if xPlayer ~= nil then
xPlayer.setJob(job, grade) xPlayer.setJob(job, grade)
end end