Added case list view & a block for adding cases

This commit is contained in:
naomi 2022-05-07 17:13:29 +01:00
parent 7f5838aa84
commit 9b73df4472
35 changed files with 864 additions and 0 deletions

View File

@ -0,0 +1,25 @@
uuid: 001657a3-682d-443d-971a-92f237f03618
langcode: en
status: true
dependencies:
module:
- opencase_cases
- route_condition
theme:
- bartik
id: addcase
theme: bartik
region: sidebar_second
weight: -8
provider: null
plugin: add_case
settings:
id: add_case
label: 'Add Case'
label_display: visible
provider: opencase_cases
visibility:
route:
id: route
negate: false
routes: entity.oc_actor.canonical

View File

@ -0,0 +1,2 @@
data:
oc_case_type: oc_case_type

View File

@ -71,6 +71,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
notes: true
status: true
total_fee: true

View File

@ -53,6 +53,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -61,6 +61,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -53,6 +53,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -60,6 +60,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -53,6 +53,8 @@ content:
allow_user_settings: true
third_party_settings: { }
hidden:
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -27,6 +27,7 @@ content:
placeholder: ''
third_party_settings: { }
hidden:
description: true
name: true
oc_fee_category: true
revision_log: true

View File

@ -74,6 +74,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
search_api_excerpt: true

View File

@ -55,6 +55,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -66,6 +66,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -55,6 +55,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -63,6 +63,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -55,6 +55,8 @@ content:
hidden:
changed: true
created: true
field_fee_calculation: true
field_fee_or_equivalent_cost: true
name: true
notes: true
oc_target: true

View File

@ -29,6 +29,7 @@ content:
weight: 0
region: content
hidden:
description: true
name: true
oc_fee_category: true
search_api_excerpt: true

View File

@ -13,10 +13,12 @@ module:
color: 0
comment: 0
config: 0
config_view: 0
contact: 0
contextual: 0
csv_serialization: 0
ctools: 0
ctools_block: 0
ctools_entity_mask: 0
date_popup: 0
datetime: 0

View File

@ -0,0 +1,21 @@
uuid: 96f7ac9c-5cbc-44f3-b414-16f1013de805
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.accommodation
module:
- options
id: oc_case.accommodation.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: accommodation
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: f02e6290-9a20-4f32-b56b-1ca92d116e08
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.accommodation
id: oc_case.accommodation.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: accommodation
label: 'Fee or equivalent cost'
description: 'If the case is pro bono, state what it would have cost if it were fee paying.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,21 @@
uuid: 3e387db9-252d-4ee4-af7a-3fc98016c231
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.asylum_support
module:
- options
id: oc_case.asylum_support.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: asylum_support
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: 0377978c-7e7f-4bfd-a55c-7fccf992022d
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.asylum_support
id: oc_case.asylum_support.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: asylum_support
label: 'Fee or equivalent cost'
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,21 @@
uuid: 7cd8962e-ce35-4d4d-807b-92e202f3e011
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.employability
module:
- options
id: oc_case.employability.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: employability
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: aa3063fb-4d0f-4ebd-9293-fbd1d52fe33c
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.employability
id: oc_case.employability.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: employability
label: 'Fee or equivalent cost'
description: 'If the case is pro bono, state what it would have cost if it were fee paying.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,21 @@
uuid: 366fddf9-2fc2-4559-af49-bb1bedb0fd32
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.health
module:
- options
id: oc_case.health.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: health
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: 9d1c9cf8-5e49-4fa4-b81a-d3a5dd7d9698
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.health
id: oc_case.health.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: health
label: 'Fee or equivalent cost'
description: 'If the case is pro bono, state what it would have cost if it were fee paying.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,21 @@
uuid: 87c8d4f1-963a-4150-952f-676ce09137a7
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.immigration
module:
- options
id: oc_case.immigration.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: immigration
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: 4e82ad9f-4e8a-439d-8bbd-17e497bd9e01
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.immigration
id: oc_case.immigration.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: immigration
label: 'Fee or equivalent cost'
description: 'If the case is pro bono, state what it would have cost if it were fee paying.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,21 @@
uuid: f5a43306-3564-47ea-8b0d-fa8c9e18c16d
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_calculation
- opencase_cases.oc_case_type.welfare_rights
module:
- options
id: oc_case.welfare_rights.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
bundle: welfare_rights
label: 'Fee calculation'
description: 'If it is per hour, it will be calculated according to the sum of time spent on all the activities logged on the case.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings: { }
field_type: list_string

View File

@ -0,0 +1,23 @@
uuid: f38fe7ef-bb7c-41af-8dbe-23ba8d8b199c
langcode: en
status: true
dependencies:
config:
- field.storage.oc_case.field_fee_or_equivalent_cost
- opencase_cases.oc_case_type.welfare_rights
id: oc_case.welfare_rights.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
bundle: welfare_rights
label: 'Fee or equivalent cost'
description: 'If the case is pro bono, state what it would have cost if it were fee paying.'
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: £
suffix: ''
field_type: decimal

View File

@ -0,0 +1,27 @@
uuid: aaf7cf91-c015-4468-9166-849311753ef1
langcode: en
status: true
dependencies:
module:
- opencase_entities
- options
id: oc_case.field_fee_calculation
field_name: field_fee_calculation
entity_type: oc_case
type: list_string
settings:
allowed_values:
-
value: 'Complete case'
label: 'Complete case'
-
value: 'Per hour'
label: 'Per hour'
allowed_values_function: ''
module: options
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -0,0 +1,20 @@
uuid: 35a6a6f4-9dbe-40ed-9a56-927ffda26e15
langcode: en
status: true
dependencies:
module:
- opencase_entities
id: oc_case.field_fee_or_equivalent_cost
field_name: field_fee_or_equivalent_cost
entity_type: oc_case
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@ -0,0 +1,20 @@
uuid: 82123195-ae6e-4d7a-9755-df73244e110d
langcode: en
status: true
dependencies: { }
id: caseworker
label: Caseworker
weight: 5
is_admin: null
permissions:
- 'add activity entities'
- 'add case entities'
- 'add client entities'
- 'delete activity entities'
- 'delete case entities'
- 'delete client entities'
- 'edit activity entities'
- 'edit case entities'
- 'edit client entities'
- 'view own cases'
- 'view published client entities'

View File

@ -0,0 +1,176 @@
uuid: 5f46805d-e571-4b2c-b319-0250135e512b
langcode: en
status: true
dependencies:
module:
- config_view
- oc_case_type
id: add_case
label: 'Add case'
module: views
description: ''
tag: ''
base_table: oc_case_type
base_field: id
display:
default:
id: default
display_title: Default
display_plugin: default
position: 0
display_options:
title: 'Add case'
fields:
id:
id: id
table: oc_case_type
field: id
relationship: none
group_type: group
admin_label: ''
entity_type: null
entity_field: null
plugin_id: standard
label: ''
exclude: true
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
label:
id: label
table: oc_case_type
field: label
relationship: none
group_type: group
admin_label: ''
plugin_id: standard
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: true
path: '/opencase/oc_case/add/{{ id }}'
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
pager:
type: none
options:
offset: 0
items_per_page: null
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
access:
type: none
options: { }
cache:
type: tag
options: { }
empty: { }
sorts: { }
arguments: { }
filters: { }
style:
type: html_list
row:
type: fields
query:
type: views_query
options: { }
relationships: { }
header: { }
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
tags: { }
block_1:
id: block_1
display_title: Block
display_plugin: block
position: 1
display_options:
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
tags: { }

View File

@ -89,6 +89,136 @@ display:
multi_type: separator
separator: ', '
field_api_classes: false
type:
id: type
table: oc_case_field_data
field: type
relationship: none
group_type: group
admin_label: ''
entity_type: oc_case
entity_field: type
plugin_id: field
label: 'Case type'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
oc_target:
id: oc_target
table: oc_case_field_data
field: oc_target
relationship: none
group_type: group
admin_label: ''
entity_type: oc_case
entity_field: oc_target
plugin_id: field
label: Target
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
pager:
type: mini
options:
@ -159,6 +289,137 @@ display:
display_plugin: block
position: 2
display_options:
fields:
name:
id: name
table: oc_case_field_data
field: name
relationship: none
group_type: group
admin_label: ''
entity_type: null
entity_field: name
plugin_id: field
label: Title
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
type:
id: type
table: oc_case_field_data
field: type
relationship: none
group_type: group
admin_label: ''
entity_type: oc_case
entity_field: type
plugin_id: field
label: 'Case type'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
group_column: target_id
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
arguments:
oc_target:
id: oc_target
@ -199,6 +460,7 @@ display:
break_phrase: false
not: false
defaults:
fields: false
arguments: false
display_extenders: { }
block_description: 'Cases: by target'

View File

@ -0,0 +1,40 @@
<?php
namespace Drupal\opencase_cases\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Provides a Block for adding a case for the current client
*
* @Block(
* id = "add_case",
* admin_label = @Translation("Add Case"),
* category = @Translation("Opencase"),
* )
*/
class AddCase extends BlockBase {
/**
* {@inheritdoc}
*/
public function build():array {
$target_id = \Drupal::routeMatch()->getParameter('oc_actor')->id();
$case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_case');
$markup = "<ul>";
foreach($case_types as $id => $info) {
$label = $info['label'];
$markup .= "<li><a href='/opencase/oc_case/add/$id?target_id=$target_id'>$label</a></li>";
}
$markup .= "</ul>";
return array(
'#markup' => $markup
);
}
public function getCacheMaxAge():int {
return 0;
}
}