-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(task_collection): add
computeState()
and display state on deli…
…very list fixes: #3806
- Loading branch information
Showing
8 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace AppBundle\Enum; | ||
|
||
enum TaskCollectionState { | ||
case PENDING; | ||
case IN_DELIVERY; | ||
case DELIVERED; | ||
case FAILED; | ||
case CANCELLED; | ||
|
||
function toGlyph() { | ||
return match ($this) { | ||
TaskCollectionState::PENDING => '⏲️', | ||
TaskCollectionState::IN_DELIVERY => '🚴♂️', | ||
TaskCollectionState::DELIVERED => '✅', | ||
TaskCollectionState::FAILED => '⚠️', | ||
TaskCollectionState::CANCELLED => '❌' | ||
}; | ||
} | ||
|
||
function toFontAwesome() { | ||
return match ($this) { | ||
TaskCollectionState::PENDING => 'clock-o', | ||
TaskCollectionState::IN_DELIVERY => 'bicycle', | ||
TaskCollectionState::DELIVERED => 'check', | ||
TaskCollectionState::FAILED => 'exclamation-triangle', | ||
TaskCollectionState::CANCELLED => 'times' | ||
}; | ||
} | ||
|
||
function toLabel() { | ||
return match ($this) { | ||
TaskCollectionState::PENDING => 'delivery.state.pending', | ||
TaskCollectionState::IN_DELIVERY => 'delivery.state.in_delivery', | ||
TaskCollectionState::DELIVERED => 'delivery.state.delivered', | ||
TaskCollectionState::FAILED => 'delivery.state.failed', | ||
TaskCollectionState::CANCELLED => 'delivery.state.cancelled' | ||
}; | ||
} | ||
|
||
function toColor() { | ||
return match ($this) { | ||
TaskCollectionState::PENDING => 'grey', | ||
TaskCollectionState::IN_DELIVERY => 'skyblue', | ||
TaskCollectionState::DELIVERED => 'green', | ||
TaskCollectionState::FAILED => 'orange', | ||
TaskCollectionState::CANCELLED => 'red' | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters