diff --git a/controllers/Countries.php b/controllers/Countries.php index 40e5fc6..d27c5cb 100644 --- a/controllers/Countries.php +++ b/controllers/Countries.php @@ -1,5 +1,6 @@ = 30) { + return 'Extremely Dangerous'; + } else if ($dangerScore >= 20) { + return 'Dangerous'; + } else if ($dangerScore >= 15) { + return 'Maintain Caution'; + } else if ($dangerScore >= 10) { + return 'Keep Alert'; + } else if ($dangerScore >= 5) { + return 'Low Risk'; + } else { + return 'No Risk'; + } + } } diff --git a/models/country/fields.yaml b/models/country/fields.yaml index 57e0edf..6d9d297 100644 --- a/models/country/fields.yaml +++ b/models/country/fields.yaml @@ -124,12 +124,18 @@ tabs: validation: required: message: Please select a type + danger: + title: Danger Index + type: computed + dependsOn: [rating, type] + callback: onGetDangerComputedValue locations: tab: Related label: Locations prompt: Add new location span: full type: repeater + minItems: 1 form: fields: country: