public async Task <IActionResult> EditUnitType(int unitTypeId) { var model = new EditUnitTypeView(); model.UnitType = await _unitsService.GetUnitTypeByIdAsync(unitTypeId); var states = new List <CustomState>(); states.Add(new CustomState { Name = "Standard Actions" }); states.AddRange(await _customStateService.GetAllActiveUnitStatesForDepartmentAsync(DepartmentId)); model.States = states; model.UnitCustomStatesId = model.UnitType.CustomStatesId.GetValueOrDefault(); return(View(model)); }
public async Task <IActionResult> GetUnitStatusesLevelsForDepartment(bool includeAny, int unitTypeId) { List <PersonnelStatusJson> personnelStauses = new List <PersonnelStatusJson>(); CustomState customState = null; var unitType = await _unitsService.GetUnitTypeByIdAsync(unitTypeId); if (unitType.CustomStatesId.HasValue && unitType.CustomStatesId.Value > 0) { customState = await _customStateService.GetCustomSateByIdAsync(unitType.CustomStatesId.Value); } if (includeAny) { personnelStauses.Add(new PersonnelStatusJson() { Id = -1, Name = "Any" }); } if (customState != null) { foreach (var detail in customState.GetActiveDetails()) { var status = new PersonnelStatusJson(); status.Id = detail.CustomStateDetailId; status.Name = detail.ButtonText; personnelStauses.Add(status); } } else { personnelStauses.Add(new PersonnelStatusJson() { Id = 0, Name = "Available" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 1, Name = "Delayed" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 2, Name = "Unavailable" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 3, Name = "Committed" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 4, Name = "Out Of Service" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 5, Name = "Responding" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 6, Name = "On Scene" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 7, Name = "Staging" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 8, Name = "Returning" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 9, Name = "Cancelled" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 10, Name = "Released" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 11, Name = "Manual" }); personnelStauses.Add(new PersonnelStatusJson() { Id = 12, Name = "Enroute" }); } return(Json(personnelStauses)); }