| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- using Comal.Classes;
- using InABox.Configuration;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.Wpf;
- using PRSDesktop.Components.Spreadsheet;
- using PRSStores.AssignmentCosting;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRSDesktop;
- public static class HumanResourcesSetupActions
- {
- public static void SecurityGroups(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<SecurityGroup>("Security Groups", PRSDesktop.Resources.securitygroup, (action) =>
- {
- var list = new MasterList(typeof(SecurityGroup));
- list.ShowDialog();
- Security.Reset();
- });
- }
- public static void EmployeeGroups(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeeGroup>("Employee Groups", PRSDesktop.Resources.employees, (action) =>
- {
- var list = new MasterList(typeof(EmployeeGroup));
- list.ShowDialog();
- });
- }
- public static void EmployeePositions(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeePosition>("Positions", PRSDesktop.Resources.position, (action) =>
- {
- var list = new MasterList(typeof(EmployeePosition));
- list.ShowDialog();
- });
- }
- public static void EmployeeRoles(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeeRole>("Roles", PRSDesktop.Resources.employeerole, (action) =>
- {
- var list = new MasterList(typeof(Role));
- list.ShowDialog();
- });
- }
- public static void EmployeeTeams(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeeTeam>("Teams", PRSDesktop.Resources.team, (action) =>
- {
- var list = new MasterList(typeof(Team));
- list.ShowDialog();
- });
- }
- public static void EmployeeActivities(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<Activity>("Activities", PRSDesktop.Resources.quality, (action) =>
- {
- var list = new MasterList(typeof(Activity));
- list.ShowDialog();
- });
- }
- public static void EmployeeQualifications(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<Qualification>("Qualifications", PRSDesktop.Resources.certificate, (action) =>
- {
- var list = new MasterList(typeof(Qualification));
- list.ShowDialog();
- });
- }
- public static void EmployeeRosters(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeeRoster>("Rosters", PRSDesktop.Resources.assignments, (action) =>
- {
- var list = new MasterList(typeof(EmployeeRoster));
- list.ShowDialog();
- });
- }
- public static void EmployeeOvertimeRules(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<OvertimeRule>("Overtime Rules", PRSDesktop.Resources.overtime, (action) =>
- {
- var list = new MasterList(typeof(OvertimeRule));
- list.ShowDialog();
- });
- }
- public static void EmployeeOvertime(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<Overtime>("Overtime", PRSDesktop.Resources.overtime, (action) =>
- {
- var list = new MasterList(typeof(Overtime));
- list.ShowDialog();
- });
- }
-
- public static void LeaveRequestApprovals(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<StandardLeave>("Leave Request Approvals", PRSDesktop.Resources.leave, (action) =>
- {
- var list = new MasterList(typeof(LeaveRequestApprovalSet));
- list.ShowDialog();
- });
- }
- public static void EmployeeStandardLeave(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<StandardLeave>("Standard Leave", PRSDesktop.Resources.fireworks, (action) =>
- {
- var list = new MasterList(typeof(StandardLeave));
- list.ShowDialog();
- });
- }
- public static void EmployeeSpreadsheetTemplates(IPanelHost host)
- {
- host.CreateSetupActionIfCanView<EmployeeSpreadsheet>("Spreadsheet Templates", PRSDesktop.Resources.box, (action) =>
- {
- SpreadsheetTemplateGrid.ViewSpreadsheetTemplates<Employee>();
- });
- }
- public static void AssignmentCostingSettings(IPanelHost host)
- {
- host.CreateSetupActionIf<CanConfigureAssignmentCosting>("Assignment Costing Settings", PRSDesktop.Resources.edit, (action) =>
- {
- var settings = new GlobalConfiguration<AssignmentCostSettings>().Load();
- if (DynamicGridUtils.EditObject(settings, customiseGrid: grid =>
- {
- grid.OnCustomiseEditor += Grid_OnCustomiseEditor;
- }))
- {
- new GlobalConfiguration<AssignmentCostSettings>().Save(settings);
- }
- });
- }
- private static void Grid_OnCustomiseEditor(IDynamicEditorForm sender, AssignmentCostSettings[]? items, DynamicGridColumn column, BaseEditor editor)
- {
- if (items?.FirstOrDefault() is not AssignmentCostSettings settings) return;
- if(column.ColumnName == nameof(AssignmentCostSettings.Script) && editor is ScriptEditor scriptEditor)
- {
- scriptEditor.Type = ScriptEditorType.TemplateEditor;
- scriptEditor.OnEditorClicked += () =>
- {
- var script = settings.Script.NotWhiteSpaceOr()
- ?? AssignmentCostingUtils.DefaultScript();
- var editor = new ScriptEditorWindow(script, SyntaxLanguage.CSharp);
- if (editor.ShowDialog() == true)
- {
- sender.SetEditorValue(column.ColumnName, editor.Script);
- settings.Script = editor.Script;
- }
- };
- }
- }
- }
|