---
description: Config = {}
---

# PROGRESS & NOTIFY

```lua
-- This configuration file is designed for a user interface in a game or application.
-- It allows for the registration of different types of markers, notifications, and progress indicators.

Config = {
    Register = 'private', -- This specifies the visibility of the marker, either private or public.
    Keyboard = 'J', -- This key is used to trigger certain actions related to the marker.
}

-- This function opens a menu in the user interface.
Config.Open = function()
    SendNUIMessage({
        data = 'MENU', -- The type of data being sent to the UI.
        open = true, -- This indicates that the menu should be opened.
    })
    SetNuiFocus(true, true) -- This sets the focus to the NUI, allowing user interaction.
end

-- This function sends a notification to the user.
Config.SendNotification = function(model, title, text, duration)
    local icon -- Variable to hold the icon path.
    local color -- Variable to hold the color code.
    if model == 'success' then
        icon = './assets/img/success.png' -- Icon for success notifications.
        color = '#3CEFCE' -- Color for success notifications.
    elseif model == 'info' then
        icon = './assets/img/info.png' -- Icon for info notifications.
        color = '#1FAAF8' -- Color for info notifications.
    elseif model == 'warning' then
        icon = './assets/img/warning.png' -- Icon for warning notifications.
        color = '#FFA500' -- Color for warning notifications.
    else
        icon = './assets/img/error.png' -- Icon for error notifications.
        color = '#DC143C' -- Color for error notifications.
    end
    print("Sending Notification:", title, text, icon, duration, color) -- Log the notification details.
    SendNUIMessage({
        data = 'NOTIFICATION', -- The type of data being sent for the notification.
        title = title, -- The title of the notification.
        text = text, -- The text content of the notification.
        icon = icon, -- The icon associated with the notification.
        duration = duration, -- How long the notification should be displayed.
        color = color, -- The color of the notification.
    })
end

-- This function sends a progress update to the user interface.
Config.SendProgress = function(title, duration)
    SendNUIMessage({
        data = 'PROGRESS', -- The type of data being sent for progress updates.
        title = title, -- The title of the progress update.
        duration = duration, -- How long the progress should be displayed.
    })
end
```

Send:

```lua
RegisterNetEvent('es-progress:sendProgress', function(name, time)
    exports['es-progress']:SendProgress(name, time)  
end)

exports('es-progress:SendNotification', function(model, title, text, duration)
    exports['es-progress']:SendNotification(model, title, text, duration)
end)

```
