#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * Submits the timesheet
 *
 * Arguments:
 * None
 *
 * Return Value:
 * None
 *
 * Examples:
 * None
 *
 * Public: Yes
 */

private _payMultiplyer = "MULTIPLYR" call BFUNC(getParamValue);
private _plyscore = rating player; //TODO: Implement rating from server
private _multiplyer = _plyscore * _payMultiplyer;

_bank = _bank + _multiplyer;

private _formattedRating = _bank call EFUNC(misc,formatNumber);
private _messageData = createHashMapFromArray [
    ["event", "SUBMIT::TIMESHEET"],
    ["data", []]
];

private _response = ["forge_client_bank_handleEvents", (toJSON _messageData)] call CFUNC(localEvent);

if (_response) then {
    [format ["Submitted timesheet! Received $%1 based on rating of %2", _formattedRating, _plyscore], "info", 3, "right"] call EFUNC(misc,notify);
} else {
    [format ["Timesheet submission failed"], "warning", 3, "right"] call EFUNC(misc,notify);
};

[] call FUNC(refresh);