- Add a dispatcher web view and layout switching - Route group role updates and dispatcher hydration through the UI bridge - Refresh top bar and hide map/side panel outside operations mode
158 lines
6.0 KiB
Plaintext
158 lines
6.0 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* File: fnc_initCadStore.sqf
|
|
* Author: IDSolutions
|
|
* Date: 2026-03-29
|
|
* Public: Yes
|
|
*
|
|
* Description:
|
|
* Initializes the CAD store as a coordinator over activity, group,
|
|
* assignment, and permission domain objects.
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* CAD store object [HASHMAP OBJECT]
|
|
*
|
|
* Example:
|
|
* call forge_server_cad_fnc_initCadStore
|
|
*/
|
|
|
|
#pragma hemtt ignore_variables ["_self"]
|
|
GVAR(CadStoreBaseClass) = compileFinal createHashMapFromArray [
|
|
["#type", "CadStoreBaseClass"],
|
|
["#create", compileFinal {
|
|
private _activityRepository = call FUNC(initActivityRepository);
|
|
private _permissionService = call FUNC(initPermissionService);
|
|
private _groupRepository = call FUNC(initGroupRepository);
|
|
private _assignmentRepository = call FUNC(initAssignmentRepository);
|
|
|
|
_groupRepository set ["activityRepository", _activityRepository];
|
|
_groupRepository set ["assignmentRepository", _assignmentRepository];
|
|
_groupRepository set ["permissionService", _permissionService];
|
|
|
|
_assignmentRepository set ["activityRepository", _activityRepository];
|
|
_assignmentRepository set ["groupRepository", _groupRepository];
|
|
_assignmentRepository set ["permissionService", _permissionService];
|
|
|
|
_self set ["ActivityRepository", _activityRepository];
|
|
_self set ["PermissionService", _permissionService];
|
|
_self set ["GroupRepository", _groupRepository];
|
|
_self set ["AssignmentRepository", _assignmentRepository];
|
|
|
|
["INFO", "CAD Store Initialized!"] call EFUNC(common,log);
|
|
}],
|
|
["appendActivity", compileFinal {
|
|
(_self get "ActivityRepository") call ["appendActivity", _this]
|
|
}],
|
|
["resolveGroupId", compileFinal {
|
|
(_self get "GroupRepository") call ["resolveGroupId", _this]
|
|
}],
|
|
["canDispatch", compileFinal {
|
|
(_self get "PermissionService") call ["canDispatch", _this]
|
|
}],
|
|
["getCurrentTaskIdForGroup", compileFinal {
|
|
(_self get "GroupRepository") call ["getCurrentTaskIdForGroup", _this]
|
|
}],
|
|
["syncGroups", compileFinal {
|
|
(_self get "GroupRepository") call ["syncGroups", _this]
|
|
}],
|
|
["getGroupRecord", compileFinal {
|
|
(_self get "GroupRepository") call ["getGroupRecord", _this]
|
|
}],
|
|
["getPlayerGroupId", compileFinal {
|
|
(_self get "GroupRepository") call ["getPlayerGroupId", _this]
|
|
}],
|
|
["isGroupLeader", compileFinal {
|
|
(_self get "GroupRepository") call ["isGroupLeader", _this]
|
|
}],
|
|
["pruneAssignments", compileFinal {
|
|
(_self get "AssignmentRepository") call ["pruneAssignments", _this]
|
|
}],
|
|
["buildContracts", compileFinal {
|
|
(_self get "AssignmentRepository") call ["buildContracts", _this]
|
|
}],
|
|
["buildGroups", compileFinal {
|
|
(_self get "GroupRepository") call ["buildGroups", _this]
|
|
}],
|
|
["notifyPlayer", compileFinal {
|
|
params [
|
|
["_uid", "", [""]],
|
|
["_type", "info", [""]],
|
|
["_title", "CAD", [""]],
|
|
["_message", "", [""]]
|
|
];
|
|
|
|
if (_uid isEqualTo "" || { _message isEqualTo "" }) exitWith { false };
|
|
|
|
private _player = [_uid] call EFUNC(common,getPlayer);
|
|
if (_player isEqualTo objNull) exitWith { false };
|
|
|
|
[CRPC(notifications,recieveNotification), [_type, _title, _message], _player] call CFUNC(targetEvent);
|
|
true
|
|
}],
|
|
["assignTaskToGroup", compileFinal {
|
|
private _result = (_self get "AssignmentRepository") call ["assignTaskToGroup", _this];
|
|
if !(_result getOrDefault ["success", false]) exitWith { _result };
|
|
|
|
private _assignment = _result getOrDefault ["assignment", createHashMap];
|
|
private _taskID = _assignment getOrDefault ["taskId", ""];
|
|
private _leaderUid = _result getOrDefault ["leaderUid", ""];
|
|
|
|
_self call ["notifyPlayer", [
|
|
_leaderUid,
|
|
"info",
|
|
"Tasks",
|
|
format ["Contract assigned: %1. Open CAD to review and acknowledge.", _taskID]
|
|
]];
|
|
|
|
_result
|
|
}],
|
|
["acknowledgeTask", compileFinal {
|
|
(_self get "AssignmentRepository") call ["acknowledgeTask", _this]
|
|
}],
|
|
["declineTask", compileFinal {
|
|
(_self get "AssignmentRepository") call ["declineTask", _this]
|
|
}],
|
|
["updateGroupStatus", compileFinal {
|
|
(_self get "GroupRepository") call ["updateGroupStatus", _this]
|
|
}],
|
|
["updateGroupRole", compileFinal {
|
|
(_self get "GroupRepository") call ["updateGroupRole", _this]
|
|
}],
|
|
["buildHydratePayload", compileFinal {
|
|
params [["_uid", "", [""]]];
|
|
|
|
private _activityRepository = _self get "ActivityRepository";
|
|
private _permissionService = _self get "PermissionService";
|
|
private _groupRepository = _self get "GroupRepository";
|
|
private _assignmentRepository = _self get "AssignmentRepository";
|
|
|
|
private _actor = EGVAR(actor,Registry) getOrDefault [_uid, createHashMap];
|
|
if (_actor isEqualTo createHashMap && { _uid isNotEqualTo "" }) then {
|
|
_actor = EGVAR(actor,ActorStore) call ["init", [_uid]];
|
|
};
|
|
|
|
private _groupID = _groupRepository call ["getPlayerGroupId", [_uid]];
|
|
|
|
createHashMapFromArray [
|
|
["groups", _groupRepository call ["buildGroups", []]],
|
|
["contracts", _assignmentRepository call ["buildContracts", [_uid]]],
|
|
["assignments", _assignmentRepository call ["getAssignments", []]],
|
|
["activity", _activityRepository call ["getActivity", []]],
|
|
["session", createHashMapFromArray [
|
|
["uid", _uid],
|
|
["orgId", _actor getOrDefault ["organization", "default"]],
|
|
["isDispatcher", _permissionService call ["canDispatch", [_uid]]],
|
|
["groupId", _groupID],
|
|
["isLeader", _groupRepository call ["isGroupLeader", [_uid, _groupID]]]
|
|
]]
|
|
]
|
|
}]
|
|
];
|
|
|
|
GVAR(CadStore) = createHashMapObject [GVAR(CadStoreBaseClass)];
|
|
GVAR(CadStore)
|