#include "..\script_component.hpp"

/*
 * Function: forge_client_admin_fnc_adminRefresh
 * Author: IDSolutions
 *
 * [Description]
 * Refreshes the admin interface player list and resets input fields.
 * This function populates the player list with names and paygrades,
 * storing player UIDs as data for each entry. Only shows players
 * on the same side as the admin.
 *
 * Arguments:
 * 0: Dummy <ANY> - Optional parameter, not used (for compatibility with event handlers)
 *
 * Return Value:
 * None
 *
 * Examples:
 * [] call forge_client_admin_fnc_adminRefresh;
 * ["dummy"] call forge_client_admin_fnc_adminRefresh;
 *
 * Public: No - Called from admin dialog controls
 */


private _dialog = findDisplay 202303;
private _list = _dialog displayCtrl 2023001;

lbClear _list;

{
	if (str (side _x) == str (playerSide)) then {
		private _name = name (_x);
		private _paygrade = GETVAR(_x,FORGE_PayGrade,QUOTE(E1));
		private _index = _list lbAdd format["%1 - %2", _name, _paygrade];

		_list lbSetData [_index, getPlayerUID _x];
	};
} forEach allPlayers;

lbSetCurSel [2023001, 0];
ctrlSetText [2023005, ""];
ctrlSetText [2023006, ""];