diff --git a/.github/ISSUE_TEMPLATE/redirect-request-facility-url.md b/.github/ISSUE_TEMPLATE/redirect-request-facility-url.md deleted file mode 100644 index 5dbd46dc5f..0000000000 --- a/.github/ISSUE_TEMPLATE/redirect-request-facility-url.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Redirect Request - Facility URL -about: Submit a request to change a URL and/or implement a redirect for a URL. -title: 'Redirect Request for: ' -labels: Redirect request -assignees: '' - ---- - -### Instructions -(Note: This issue will be used from initial request through implementation to ensure all individuals working on this are notified of status updates. Please do not create multiple issues to track different steps.) -- [ ] Notify VA stakeholders as appropriate. -- [ ] Link the related facility closure / rename issue. -- [ ] Create a URL redirect in the [devops](https://github.com/department-of-veterans-affairs/devops) repo in `ansible/deployment/config/revproxy-vagov/vars/redirects.yml` -- [ ] Add the "Awaiting redirect" flag to the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state. -- [ ] Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. After deploy, validate that the URL redirect is deployed. (Note: In the event of a facility closure or a name change, validate that this occurs before making the Lighthouse csv changes.) -- [ ] Update this ticket with a comment that the redirect has been deployed. -- [ ] Remove the "Awaiting redirect" flag on the facility node with a revision log message that includes a link to this ticket, preserving the node's current moderation state. - -### Implementation date -When does this request need to be live: - -### Redirects -| Current URL | Redirect Destination or New URL | -| --- | --- | -| current URL | new URL | diff --git a/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md b/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md index 528a99c51e..2d7c59dcc7 100644 --- a/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md +++ b/.github/ISSUE_TEMPLATE/runbook-facility-url-change.md @@ -6,6 +6,8 @@ labels: Facilities, Drupal engineering, Flagged Facilities, Redirect request, UR assignees: '' --- +Parent ticket: #number-of-GH-ticket + ### Implementation date When does this request need to be live: [MM/DD/YYYY] diff --git a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-closed.md b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-closed.md index b17d33f53e..c46e422579 100644 --- a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-closed.md +++ b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-closed.md @@ -58,7 +58,7 @@ If this facility has been removed from VAST in error, please notify the VA Drupa [outro] [CMS helpdesk signature] - + Alternative, for "Removed From Source" flag follow-up: ----------------------- During a site-wide review, our team found a location within the [INSERT SYSTEM NAME] health care system that is no longer listed within the Facilities API, but still exists within Drupal. @@ -69,26 +69,26 @@ Here is a link to the clinic homepage, which is still published on the live site Here is a link to this page on the production site: [INSERT CLINIC HOMEPAGE LINK FROM PRODUCTION SITE] -IF THIS FACILITY IS CLOSED: +IF THIS FACILITY IS CLOSED: Please follow the steps listed in the following Knowledge Base article in order to fully archive it from VA.gov: https://prod.cms.va.gov/help/vamc/about-locations-content-for-vamcs/how-to-archive-a-closed-facility -Important: Once these steps have been followed, please reach back out to the VA Drupal CMS Help Desk by replying to this email or by writing to support@va-gov.atlassian.net. +Important: Once these steps have been followed, please reach back out to the VA Drupal CMS Help Desk by replying to this email or by writing to support@va-gov.atlassian.net. From there, our engineering team will proceed with next steps for archiving this facility. If the clinic has not been closed, please also let our team know as soon as possible. Thank you for your help! - + [Signature] - + ``` - [ ] 4. Are any of the services or upcoming events for the facility to be closed moving to a different facility? - [ ] 4a. If so, note the facility picking up the services and events here: - [ ] 4b. If so, note the services and events here: -- [ ] 5. Create a [redirect request](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/new?assignees=&labels=Redirect+request&template=redirect-request-facility-url.md&title=Redirect+Request+for%3A+%3Cinsert+facility+name%3E) from the URL of the facility to be closed to the URL of its parent system. +- [ ] 5. Create a [URL change](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/new?assignees=&template=runbook-facility-url-change.md&title=URL+Change+for%3A+%3Cinsert+facility+name%3E) to redirect the from the URL of the facility to be closed to the URL of its parent system and to remove the old canonical link. diff --git a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md index 3fa8c01d2e..a8a72c885b 100644 --- a/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md +++ b/.github/ISSUE_TEMPLATE/runbook-vamc-facility-new.md @@ -61,8 +61,6 @@ Please let us know when your draft content is complete, so that we can wrap up t #### CMS engineer steps - [ ] 7. CMS engineer executes the steps of the URL change request ticket from step 5 above. -(Redirects deploy daily except Friday at 10am ET, or by requesting OOB deploy (of the revproxy job to prod) in #vfs-platform-support. Coordinate the items below and canonical URL change after URL change ticket is merged, deployed, and verified in prod.) - #### Drupal Admin steps (CMS Engineer or Help desk) _Help desk will complete these steps or escalate to request help from CMS engineering._ - [ ] 8. Drupal Admin bulk publishes nodes and facility. diff --git a/.github/ISSUE_TEMPLATE/runbook-vet-center-closed.md b/.github/ISSUE_TEMPLATE/runbook-vet-center-closed.md index 30ef27f13c..1c5f8ead59 100644 --- a/.github/ISSUE_TEMPLATE/runbook-vet-center-closed.md +++ b/.github/ISSUE_TEMPLATE/runbook-vet-center-closed.md @@ -17,7 +17,7 @@ Help desk ticket: - [ ] Name of submitter (if applicable) Submitter: -- [ ] Contact the Vet Center editor and send them a link to the operating status KB article. If the facility has not closed yet and we can provide lead-time, the editor should change the Facility status to "Facility notice" and provide information in the Facility Status additional information about when the facility will permanently close. +- [ ] Contact the Vet Center editor and send them a link to the operating status KB article. If the facility has not closed yet and we can provide lead-time, the editor should change the Facility status to "Facility notice" and provide information in the Facility Status additional information about when the facility will permanently close. - [ ] When the facility has already closed - including if we were unable to give the aforementioned lead time- the editor should change the Facility status to Closed and provide information in the Facility Status additional information that the facility has permanently closed as of DATE. - Vet Center Mobile autoarchive when they are removed from the facilty API. No action required. - Vet Center Outstations autoarchive when they are removed from the facilty API. No action required. @@ -41,7 +41,7 @@ Facility API ID: #### CMS help desk steps **Note: If the help desk is waiting on information from the facility staff or editor, add the "Awaiting editor" flag to the facility with a log message that includes a link to this ticket. Remove the flag when the ticket is ready to be worked by the Facilities team. Be sure to preserve the current moderation state of the node when adding or removing the flag.** - [ ] 1. Become aware that the facility is no longer on the Facility API (typically, via a Flag, but this may come in as a helpdesk ticket). -- [ ] 2. ~~CMS team submits [Redirect request](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/new?assignees=&labels=Redirect+request&template=redirect-request-facility-url.md&title=Redirect+Request+for%3A+%3Cinsert+facility+name%3E), cc'ing Facilities team, and referencing this issue.~~ redirects are not necessary for Outstations. +- [ ] 2. ~~Create a [URL change](https://github.com/department-of-veterans-affairs/va.gov-cms/issues/new?assignees=&template=runbook-facility-url-change.md&title=URL+Change+for%3A+%3Cinsert+facility+name%3E) to redirect the from the URL of the facility to be closed to the URL of its parent system and to remove the old canonical link.~~ redirects are not necessary for Outstations. #### Drupal Admin steps (CMS Engineer or Help desk) _Help desk will complete these steps or escalate to request help from CMS engineering._ diff --git a/READMES/events-api b/READMES/events-api index 179435cd80..80aebc6065 100644 --- a/READMES/events-api +++ b/READMES/events-api @@ -3,8 +3,11 @@ Directions for Events API This is a REST API created in Drupal Views using the REST UI Module. It is located in the Drupal CMS backend and is administered by the CMS team. The current location to view the API is: /all-events-data?_format=json +You can view it using an API platform (like Postman). +You will need a Drupal login (username and password). Under Basic Auth you will enter the full url - https://prod.cms.va.gov/all-events-data?_format=json and the username/password combo. +This will allow you to view the full events API data. -The API is currently set to json format but can also be used for xml or to get a csv download. This is accomplished by changing the data_format in the url above. (I.e. /all-events-data_format=csv or /all-events-data_format=xml) +The API is currently set to json format but can also be used for xml or to get a csv download. This is accomplished by changing the data?_format in the url above. (I.e. /all-events-data?_format=csv or /all-events-data?_format=xml) To make changes to the Events API in the Drupal Admin you can go to /admin/structure/views/view/events_data. Any changes made to this API require an export of Drupal config so please consult with (and have your changes reviewed by) a Drupal CMS Developer. diff --git a/config/sync/views.view.events_data.yml b/config/sync/views.view.events_data.yml index 28625603b3..03a935fb29 100644 --- a/config/sync/views.view.events_data.yml +++ b/config/sync/views.view.events_data.yml @@ -14,7 +14,7 @@ dependencies: - field.storage.node.field_location_type - field.storage.node.field_url_of_an_online_event - node.type.event - - user.role.administrator + - user.role.authenticated module: - address - csv_serialization @@ -766,7 +766,7 @@ display: type: role options: role: - administrator: administrator + authenticated: authenticated cache: type: tag options: { } @@ -895,7 +895,8 @@ display: jsonapi_views: enabled: true path: all-events-data - auth: { } + auth: + - basic_auth cache_metadata: max-age: -1 contexts: diff --git a/config/sync/views.view.facility_services.yml b/config/sync/views.view.facility_services.yml index 0b3740a023..63db5a0933 100644 --- a/config/sync/views.view.facility_services.yml +++ b/config/sync/views.view.facility_services.yml @@ -12,7 +12,6 @@ dependencies: - field.storage.node.field_geolocation - field.storage.node.field_media - field.storage.node.field_office - - field.storage.node.field_online_scheduling_availabl - field.storage.node.field_operating_status_facility - field.storage.node.field_operating_status_more_info - field.storage.node.field_referral_required @@ -23,7 +22,6 @@ dependencies: - field.storage.node.field_va_health_connect_phone - field.storage.node.field_vamc_ehr_system - field.storage.node.field_vamc_system_official_name - - field.storage.node.field_walk_ins_accepted - field.storage.paragraph.field_header - field.storage.paragraph.field_title - image.style.7_2_medium_thumbnail @@ -15127,130 +15125,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_walk_ins_accepted: - id: field_walk_ins_accepted - table: node__field_walk_ins_accepted - field: field_walk_ins_accepted - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'Walkins accepted' - 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: list_default - settings: { } - 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 - field_online_scheduling_availabl: - id: field_online_scheduling_availabl - table: node__field_online_scheduling_availabl - field: field_online_scheduling_availabl - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'Online scheduling' - 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: list_default - settings: { } - 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 revision_uid: id: revision_uid table: node_revision @@ -16106,114 +15980,6 @@ display: default_group_multiple: { } group_items: { } reduce_duplicates: false - field_walk_ins_accepted_value: - id: field_walk_ins_accepted_value - table: node__field_walk_ins_accepted - field: field_walk_ins_accepted_value - relationship: none - group_type: group - admin_label: '' - plugin_id: list_field - operator: or - value: { } - group: 1 - exposed: true - expose: - operator_id: field_walk_ins_accepted_value_op - label: 'Walkins accepted' - description: '' - use_operator: false - operator: field_walk_ins_accepted_value_op - operator_limit_selection: false - operator_list: { } - identifier: field_walk_ins_accepted_value - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - content_api_consumer: '0' - content_creator_benefits_hubs: '0' - content_creator_resources_and_support: '0' - office_content_creator: '0' - vamc_content_creator: '0' - content_creator_vet_center: '0' - content_editor: '0' - content_reviewer: '0' - content_publisher: '0' - content_admin: '0' - redirect_administrator: '0' - admnistrator_users: '0' - administrator: '0' - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - field_online_scheduling_availabl_value: - id: field_online_scheduling_availabl_value - table: node__field_online_scheduling_availabl - field: field_online_scheduling_availabl_value - relationship: none - group_type: group - admin_label: '' - plugin_id: list_field - operator: or - value: { } - group: 1 - exposed: true - expose: - operator_id: field_online_scheduling_availabl_value_op - label: 'Online scheduling' - description: '' - use_operator: false - operator: field_online_scheduling_availabl_value_op - operator_limit_selection: false - operator_list: { } - identifier: field_online_scheduling_availabl_value - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - content_api_consumer: '0' - content_creator_benefits_hubs: '0' - content_creator_resources_and_support: '0' - office_content_creator: '0' - vamc_content_creator: '0' - content_creator_vet_center: '0' - content_editor: '0' - content_reviewer: '0' - content_publisher: '0' - content_admin: '0' - redirect_administrator: '0' - admnistrator_users: '0' - administrator: '0' - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false moderation_state_multiple_workflow_filter: id: moderation_state_multiple_workflow_filter table: node @@ -16394,9 +16160,7 @@ display: - 'config:field.storage.node.field_administration' - 'config:field.storage.node.field_facility_location' - 'config:field.storage.node.field_facility_locator_api_id' - - 'config:field.storage.node.field_online_scheduling_availabl' - 'config:field.storage.node.field_referral_required' - - 'config:field.storage.node.field_walk_ins_accepted' deleted: false vamc_facility_health_services_page: id: vamc_facility_health_services_page @@ -16993,130 +16757,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_walk_ins_accepted: - id: field_walk_ins_accepted - table: node__field_walk_ins_accepted - field: field_walk_ins_accepted - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'Walkins accepted' - 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: list_default - settings: { } - 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 - field_online_scheduling_availabl: - id: field_online_scheduling_availabl - table: node__field_online_scheduling_availabl - field: field_online_scheduling_availabl - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'Online scheduling' - 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: list_default - settings: { } - 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 revision_uid: id: revision_uid table: node_revision @@ -17929,114 +17569,6 @@ display: default_group_multiple: { } group_items: { } reduce_duplicates: false - field_walk_ins_accepted_value: - id: field_walk_ins_accepted_value - table: node__field_walk_ins_accepted - field: field_walk_ins_accepted_value - relationship: none - group_type: group - admin_label: '' - plugin_id: list_field - operator: or - value: { } - group: 1 - exposed: true - expose: - operator_id: field_walk_ins_accepted_value_op - label: 'Walkins accepted' - description: '' - use_operator: false - operator: field_walk_ins_accepted_value_op - operator_limit_selection: false - operator_list: { } - identifier: field_walk_ins_accepted_value - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - content_api_consumer: '0' - content_creator_benefits_hubs: '0' - content_creator_resources_and_support: '0' - office_content_creator: '0' - vamc_content_creator: '0' - content_creator_vet_center: '0' - content_editor: '0' - content_reviewer: '0' - content_publisher: '0' - content_admin: '0' - redirect_administrator: '0' - admnistrator_users: '0' - administrator: '0' - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - field_online_scheduling_availabl_value: - id: field_online_scheduling_availabl_value - table: node__field_online_scheduling_availabl - field: field_online_scheduling_availabl_value - relationship: none - group_type: group - admin_label: '' - plugin_id: list_field - operator: or - value: { } - group: 1 - exposed: true - expose: - operator_id: field_online_scheduling_availabl_value_op - label: 'Online scheduling' - description: '' - use_operator: false - operator: field_online_scheduling_availabl_value_op - operator_limit_selection: false - operator_list: { } - identifier: field_online_scheduling_availabl_value - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - anonymous: '0' - content_api_consumer: '0' - content_creator_benefits_hubs: '0' - content_creator_resources_and_support: '0' - office_content_creator: '0' - vamc_content_creator: '0' - content_creator_vet_center: '0' - content_editor: '0' - content_reviewer: '0' - content_publisher: '0' - content_admin: '0' - redirect_administrator: '0' - admnistrator_users: '0' - administrator: '0' - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false moderation_state_multiple_workflow_filter: id: moderation_state_multiple_workflow_filter table: node @@ -18457,9 +17989,7 @@ display: - 'config:field.storage.node.field_administration' - 'config:field.storage.node.field_facility_location' - 'config:field.storage.node.field_facility_locator_api_id' - - 'config:field.storage.node.field_online_scheduling_availabl' - 'config:field.storage.node.field_referral_required' - - 'config:field.storage.node.field_walk_ins_accepted' - workbench_access_view deleted: false vamc_facility_non_clinical_services_export: diff --git a/config/sync/views.view.service_locations_audit.yml b/config/sync/views.view.service_locations_audit.yml index d9479393c6..a04b837bb4 100644 --- a/config/sync/views.view.service_locations_audit.yml +++ b/config/sync/views.view.service_locations_audit.yml @@ -430,68 +430,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_hservice_appt_intro_select: - id: field_hservice_appt_intro_select - table: node__field_hservice_appt_intro_select - field: field_hservice_appt_intro_select - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'OLD: Appointment intro text' - 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: list_default - settings: { } - 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 field_appt_intro_text_type: id: field_appt_intro_text_type table: paragraph__field_appt_intro_text_type @@ -500,7 +438,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appointment introduction text' + label: 'Appointment introduction text' exclude: false alter: alter_text: false @@ -554,68 +492,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_hservice_appt_leadin: - id: field_hservice_appt_leadin - table: node__field_hservice_appt_leadin - field: field_hservice_appt_leadin - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'OLD: Appointment lead-in text' - 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: basic_string - settings: { } - 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 field_appt_intro_text_custom: id: field_appt_intro_text_custom table: paragraph__field_appt_intro_text_custom @@ -624,7 +500,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appt Custom text' + label: 'Appt Custom text' exclude: false alter: alter_text: false @@ -678,68 +554,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_walk_ins_accepted: - id: field_walk_ins_accepted - table: node__field_walk_ins_accepted - field: field_walk_ins_accepted - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'OLD: Are walkins accepted?' - 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: list_default - settings: { } - 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 field_office_visits: id: field_office_visits table: paragraph__field_office_visits @@ -748,69 +562,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Office visits' - 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: list_default - settings: { } - 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 - field_online_scheduling_availabl: - id: field_online_scheduling_availabl - table: node__field_online_scheduling_availabl - field: field_online_scheduling_availabl - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'OLD: Is online scheduling available for this service?' + label: 'Office visits' exclude: false alter: alter_text: false @@ -872,7 +624,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Is online scheduling available for this service?' + label: 'Is online scheduling available for this service?' exclude: false alter: alter_text: false @@ -926,69 +678,6 @@ display: multi_type: separator separator: ', ' field_api_classes: false - field_phone_numbers_paragraph: - id: field_phone_numbers_paragraph - table: node__field_phone_numbers_paragraph - field: field_phone_numbers_paragraph - relationship: none - group_type: group - admin_label: '' - plugin_id: field - label: 'OLD: Phone number for appointments' - 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_revisions_entity_view - settings: - view_mode: default - group_column: '' - 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 field_other_phone_numbers: id: field_other_phone_numbers table: paragraph__field_other_phone_numbers @@ -997,7 +686,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appt: Other phone numbers' + label: 'Appt: Other phone numbers' exclude: false alter: alter_text: false @@ -1060,7 +749,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Use the facility phone number' + label: 'Use the facility phone number' exclude: false alter: alter_text: false @@ -1776,12 +1465,7 @@ display: - user.roles tags: - 'config:field.storage.node.field_administration' - - 'config:field.storage.node.field_hservice_appt_intro_select' - - 'config:field.storage.node.field_hservice_appt_leadin' - 'config:field.storage.node.field_last_saved_by_an_editor' - - 'config:field.storage.node.field_online_scheduling_availabl' - - 'config:field.storage.node.field_phone_numbers_paragraph' - - 'config:field.storage.node.field_walk_ins_accepted' - 'config:field.storage.paragraph.field_appt_intro_text_custom' - 'config:field.storage.paragraph.field_appt_intro_text_type' - 'config:field.storage.paragraph.field_office_visits' @@ -1824,12 +1508,7 @@ display: - user.roles tags: - 'config:field.storage.node.field_administration' - - 'config:field.storage.node.field_hservice_appt_intro_select' - - 'config:field.storage.node.field_hservice_appt_leadin' - 'config:field.storage.node.field_last_saved_by_an_editor' - - 'config:field.storage.node.field_online_scheduling_availabl' - - 'config:field.storage.node.field_phone_numbers_paragraph' - - 'config:field.storage.node.field_walk_ins_accepted' - 'config:field.storage.paragraph.field_appt_intro_text_custom' - 'config:field.storage.paragraph.field_appt_intro_text_type' - 'config:field.storage.paragraph.field_office_visits' @@ -2292,7 +1971,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appointment introduction text' + label: 'Appointment introduction text' exclude: false alter: alter_text: false @@ -2416,7 +2095,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appt Custom text' + label: 'Appt Custom text' exclude: false alter: alter_text: false @@ -2540,7 +2219,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Office visits' + label: 'Office visits' exclude: false alter: alter_text: false @@ -2664,7 +2343,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Is online scheduling available for this service?' + label: 'Is online scheduling available for this service?' exclude: false alter: alter_text: false @@ -2789,7 +2468,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Appt: Other phone numbers' + label: 'Appt: Other phone numbers' exclude: false alter: alter_text: false @@ -2852,7 +2531,7 @@ display: group_type: group admin_label: '' plugin_id: field - label: 'NEW: Use the facility phone number' + label: 'Use the facility phone number' exclude: false alter: alter_text: false diff --git a/docroot/modules/custom/va_gov_vet_center/src/EventSubscriber/EntityEventSubscriber.php b/docroot/modules/custom/va_gov_vet_center/src/EventSubscriber/EntityEventSubscriber.php index 0b52298924..bf46adca32 100644 --- a/docroot/modules/custom/va_gov_vet_center/src/EventSubscriber/EntityEventSubscriber.php +++ b/docroot/modules/custom/va_gov_vet_center/src/EventSubscriber/EntityEventSubscriber.php @@ -240,7 +240,84 @@ public function alterVetCenterServiceNodeForm(FormIdAlterEvent $event): void { $is_admin = $this->userPermsService->hasAdminRole(TRUE); if (!$is_admin) { $this->disableFacilityServiceChange($form, $form_state); + $this->disableArchivingRequiredServicesNonAdmins($form, $form_state); } + $this->showServiceAsRequiredOrOptional($form, $form_state); + + } + + /** + * Disable the Archived moderation state on required services for non-admins. + * + * @param array $form + * The node form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state. + */ + public function disableArchivingRequiredServicesNonAdmins(array &$form, FormStateInterface $form_state) { + $required_services = $this->requiredServices->getRequiredServices(); + $form_object = $form_state->getFormObject(); + $node = $form_object->getEntity(); + $service_id = $node->field_service_name_and_descripti->target_id; + foreach ($required_services as $required_service) { + $required_service_id = $required_service->id(); + if ($service_id == $required_service_id) { + if ($form['moderation_state']['widget'][0]['state']['#options']['archived']) { + unset($form['moderation_state']['widget'][0]['state']['#options']['archived']); + } + } + } + } + + /** + * Show service as required or optional. + * + * @param array $form + * The node form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state. + */ + public function showServiceAsRequiredOrOptional(array &$form, FormStateInterface $form_state) { + $required_services = $this->requiredServices->getRequiredServices(); + $form_object = $form_state->getFormObject(); + $node = $form_object->getEntity(); + $service_id = $node->field_service_name_and_descripti->target_id; + $service_name = $node->field_service_name_and_descripti->entity->getName(); + foreach ($required_services as $required_service) { + $required_service_id = $required_service->id(); + if ($service_id == $required_service_id) { + // This is a required service. + $service_required_or_optional = $this->t('a required'); + $can_or_cannot = $this->t('cannot'); + $service_required_or_optional_capitalized = $this->t('Required'); + break; + } + else { + // This is an optional service. + $service_required_or_optional = $this->t('an optional'); + $can_or_cannot = $this->t('can'); + $service_required_or_optional_capitalized = $this->t('Optional'); + } + } + + $required_or_optional_markup = new FormattableMarkup( + '
+

:service_required_or_optional_capitalized Service +
:service_name is :required_or_optional service. :service_required_or_optional_capitalized services :can_or_cannot be archived. Learn more in the Knowledge Base article about Vet Center Services (opens in a new window).

+
', + [ + ':service_required_or_optional_capitalized' => $service_required_or_optional_capitalized, + ':required_or_optional' => $service_required_or_optional, + ':service_name' => $service_name, + ':can_or_cannot' => $can_or_cannot, + ] + ); + $form['service_optional_or_required'] = [ + '#type' => 'markup', + '#markup' => $this->t('@markup', ['@markup' => $required_or_optional_markup]), + '#weight' => 5, + ]; + } /** diff --git a/scripts/content/vacms-17969/VACMS-17969-vba-test-data-processor.php b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-processor.php new file mode 100644 index 0000000000..620f129b60 --- /dev/null +++ b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-processor.php @@ -0,0 +1,772 @@ +getStorage('node')->load($data[1]); + $node->field_show_banner->value = $data[2]; + $node->field_alert_type->value = $data[3]; + $node->field_dismissible_option->value = $data[4]; + $node->field_banner_title->value = $data[5]; + $node->field_banner_content->value = $data[6]; + $node->field_operating_status_facility->value = $data[7]; + $node->field_operating_status_more_info->value = $data[8]; + add_prepare_for_your_visit_to_facility($node, $data[9]); + add_media_to_facility($node, $data[12]); + add_spotlights_to_facility($node, $data[13], $data[16]); + $node->moderation_state = 'published'; + save_node_revision($node, "Updated for VBA test data", TRUE); +} + +/** + * Create a VBA service region node. + * + * @param array $data + * The data from the CSV file. + */ +function create_vba_service_region_node($data) { + $service_region = Node::create([ + 'type' => 'service_region', + 'title' => $data[28], + 'field_service_name_and_descripti' => [ + 'target_id' => $data[1], + ], + 'field_administration' => [ + 'target_id' => $data[3], + ], + 'field_facility_location' => [ + 'target_id' => $data[30], + ], + 'moderation_state' => 'published', + ]); + // Create the service location paragraph(s). + $number_of_service_locations = $data[6]; + for ($i = 0; $i < $number_of_service_locations; $i++) { + $service_location = create_service_location_paragraph($data, $i); + $service_region->field_service_location->appendItem($service_location); + } + save_node_revision($service_region, "Created for VBA test data", TRUE); +} + +/** + * Create a VBA facility service node. + * + * @param array $data + * The data from the CSV file. + */ +function create_vba_facility_service_node($data) { + $facility_id = $data[1]; + $facility_section = $data[3]; + $service_id = $data[5]; + + // Create the VBA service node initially + // and then add to it the necessary service locations. + $service_node = Node::create([ + 'type' => 'vba_facility_service', + 'field_administration' => [ + 'target_id' => $facility_section, + ], + 'field_office' => [ + 'target_id' => $facility_id, + ], + 'field_service_name_and_descripti' => [ + 'target_id' => $service_id, + ], + 'moderation_state' => 'published', + ]); + $service_node->save(); + + // Create the service location paragraph(s). + $number_of_service_locations = $data[6]; + for ($i = 0; $i < $number_of_service_locations; $i++) { + $service_location = create_service_location_paragraph($data, $i); + $service_node->field_service_location->appendItem($service_location); + } + save_node_revision($service_node, "Created for VBA test data", TRUE); +} + +/** + * Create service location paragraphs. + * + * @param array $data + * The data from the CSV file. + * @param int $service_location_index + * The number of the service location creation loop. + * + * @return \Drupal\paragraphs\Entity\Paragraph + * The service location paragraph. + */ +function create_service_location_paragraph($data, $service_location_index) { + // If this is the first service location, use the data from the CSV file. + if ($service_location_index === 0) { + $service_location = Paragraph::create([ + 'type' => 'service_location', + 'field_office_visits' => $data[7], + 'field_virtual_support' => $data[8], + 'field_appt_intro_text_type' => $data[9], + 'field_appt_intro_text_custom' => $data[10] . ' for service location ' . $service_location_index + 1, + 'field_use_facility_phone_number' => $data[11], + 'field_online_scheduling_avail' => $data[15], + ]); + $number_of_appointment_phones = $data[12]; + $service_location->field_use_main_facility_phone = $data[23]; + $number_of_contact_phones = $data[24]; + $number_of_contact_emails = $data[27]; + } + else { + // If not, generate random data. + $field_appt_intro_text_type = choose_random_appt_intro_text_type(); + if ($field_appt_intro_text_type === 'customize_text') { + $field_appt_intro_text_custom = 'Random text for service location ' . $service_location_index + 1; + } + else { + $field_appt_intro_text_custom = NULL; + } + $service_location = Paragraph::create([ + 'type' => 'service_location', + 'field_office_visits' => choose_random_office_visit(), + 'field_virtual_support' => choose_random_virtual_support(), + 'field_appt_intro_text_type' => $field_appt_intro_text_type, + 'field_appt_intro_text_custom' => $field_appt_intro_text_custom, + 'field_use_facility_phone_number' => rand(0, 1), + 'field_online_scheduling_avail' => choose_random_online_scheduling_avail_option(), + ]); + $number_of_appointment_phones = rand(0, 9); + $service_location->field_use_main_facility_phone = choose_random_true_false_null(); + $number_of_contact_phones = rand(0, 5); + $number_of_contact_emails = rand(0, 5); + } + + $service_location->save(); + + create_service_location_phone_numbers($service_location, 'field_other_phone_numbers', $number_of_appointment_phones, $data[13], $data[14]); + $service_location->field_service_location_address->appendItem(create_service_location_address_paragraph($data)); + $service_location->field_hours = $data[20]; + $service_location->field_additional_hours_info = $data[22]; + // If "specify hours" is selected, create office hours. + if ($data[20] === '2') { + $service_location->field_office_hours = create_service_location_hours($data[21]); + } + create_service_location_phone_numbers($service_location, 'field_phone', $number_of_contact_phones, $data[25], $data[26]); + create_email_contacts($service_location, 'field_email_contacts', $number_of_contact_emails); + $service_location->save(); + + return $service_location; +} + +/** + * Create phone numbers for a service location. + * + * @param \Drupal\paragraphs\Entity\Paragraph $service_location + * The service location paragraph. + * @param string $paragraph_field + * The paragraph field to which the phone numbers will be appended. + * @param int $number_of_phone_numbers + * The number of phone numbers to create. + * @param string $phone_type + * The type of phone number. (e.g., 'tel', 'fax', 'sms', 'tty') + * @param int $create_extension + * Whether to create an extension for the first phone number. + */ +function create_service_location_phone_numbers($service_location, $paragraph_field, $number_of_phone_numbers, $phone_type, $create_extension) { + // There can be multiple appointment phone numbers for a service location. + // We want to ensure that the first appointment phone number is of the + // desired type and has an extension, as specified in the CSV file. + // The rest of the appointment phone numbers can be of a random type + // with random extensions or no extension. + $phone_numbers = NULL; + for ($i = 0; $i < $number_of_phone_numbers; $i++) { + if ($i === 0) { + $service_location->get($paragraph_field)->appendItem(create_phone_paragraph($i, $phone_type, (bool) $create_extension)); + } + else { + $service_location->get($paragraph_field)->appendItem(create_phone_paragraph($i, choose_random_phone_number_type(), (bool) rand(0, 1))); + } + } + + return $phone_numbers; +} + +/** + * Create a phone paragraph. + * + * @param int $phone_index + * The index of the loop to create multiple phone numbers. + * @param string $phone_type + * The type of phone number. (e.g., 'tel', 'fax', 'sms', 'tty') + * @param bool $add_extension + * Whether to add an extension to the phone number. + */ +function create_phone_paragraph($phone_index, $phone_type, $add_extension = NULL) { + $phone_number = generate_random_phone_number(); + + // We only want an extension when the phone type is 'tel'. + if ($phone_type === 'tel') { + $random_extension = (string) rand(1, 99999); + $add_extension = (is_null($add_extension)) ? rand(0, 1) : $add_extension; + } + else { + $random_extension = NULL; + $add_extension = NULL; + } + $extension = $add_extension ? $random_extension : NULL; + + $phone = Paragraph::create([ + 'type' => 'phone_number', + 'field_phone_number' => $phone_number, + 'field_phone_number_type' => $phone_type, + 'field_phone_extension' => $extension, + 'field_phone_label' => sprintf("Service location phone %d, (%s)", $phone_index + 1, $phone_type), + ]); + $phone->save(); + return $phone; +} + +/** + * Create a service location address paragraph. + * + * @param array $data + * The data from the CSV file. + * + * @return \Drupal\paragraphs\Entity\Paragraph + * The service location address paragraph. + */ +function create_service_location_address_paragraph(array $data) { + $service_location_address = Paragraph::create([ + 'type' => 'service_location_address', + 'field_clinic_name' => $data[16], + 'field_building_name_number' => $data[17], + 'field_wing_floor_or_room_number' => $data[18], + 'field_use_facility_address' => $data[19], + + ]); + if ($data[19] === '0') { + $service_location_address->field_address->setValue([ + 'country_code' => 'US', + 'administrative_area' => 'NE', + 'locality' => 'Omaha', + 'address_line1' => '1010 Dodge Street', + 'address_line2' => rand(0, 1) ? 'Suite 100' : NULL, + 'postal_code' => '68102', + ]); + } + $service_location_address->save(); + + return $service_location_address; +} + +/** + * Create service location hours. + * + * @param string $hours + * The type of hours for a facility. + */ +function create_service_location_hours($hours) { + $office_hours_sets = [ + // Open 8:00 AM - 4:00 PM Monday - Friday, closed on weekends. + 'hours_mf8_4' => [ + [ + // Sunday. + 'day' => 0, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Monday. + 'day' => 1, + 'starthours' => 800, + 'endhours' => 1600, + 'comment' => '', + ], + [ + // Tuesday. + 'day' => 2, + 'starthours' => 800, + 'endhours' => 1600, + 'comment' => '', + ], + [ + // Wednesday. + 'day' => 3, + 'starthours' => 800, + 'endhours' => 1600, + 'comment' => '', + ], + [ + // Thursday. + 'day' => 4, + 'starthours' => 800, + 'endhours' => 1600, + 'comment' => '', + ], + [ + // Friday. + 'day' => 5, + 'starthours' => 800, + 'endhours' => 1600, + 'comment' => '', + ], + [ + // Saturday. + 'day' => 6, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + ], + // Open 24/7, per the comments. + 'hours_24_7' => [ + [ + // Sunday. + 'day' => 0, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Monday. + 'day' => 1, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Tuesday. + 'day' => 2, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Wednesday. + 'day' => 3, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Thursday. + 'day' => 4, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Friday. + 'day' => 5, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + [ + // Saturday. + 'day' => 6, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => '24/7', + ], + ], + // Open 12:00 AM - 12:00 AM every day. + 'hours_12a_12a' => [ + [ + // Sunday. + 'day' => 0, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Monday. + 'day' => 1, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Tuesday. + 'day' => 2, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Wednesday. + 'day' => 3, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Thursday. + 'day' => 4, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Friday. + 'day' => 5, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + [ + // Saturday. + 'day' => 6, + 'starthours' => 0, + 'endhours' => 2400, + 'comment' => '', + ], + ], + // Closed every day. + 'hours_closed' => [ + [ + // Sunday. + 'day' => 0, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Monday. + 'day' => 1, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Tuesday. + 'day' => 2, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Wednesday. + 'day' => 3, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Thursday. + 'day' => 4, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Friday. + 'day' => 5, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + [ + // Saturday. + 'day' => 6, + 'starthours' => NULL, + 'endhours' => NULL, + 'comment' => 'Closed', + ], + ], + ]; + $service_location_hours = $office_hours_sets[$hours]; + + return $service_location_hours; +} + +/** + * Create email contacts for a service location. + * + * @param \Drupal\paragraphs\Entity\Paragraph $service_location + * The service location paragraph. + * @param string $paragraph_field + * The paragraph field to which the email contacts will be appended. + * @param int $number_of_email_addresses + * The number of email addresses to create. + */ +function create_email_contacts($service_location, $paragraph_field, $number_of_email_addresses) { + for ($i = 0; $i < $number_of_email_addresses; $i++) { + $service_location->get($paragraph_field)->appendItem(create_email_paragraph($i)); + } +} + +/** + * Create an email paragraph. + * + * @param int $email_index + * The index of the loop to create multiple email addresses. + * + * @return \Drupal\paragraphs\Entity\Paragraph + * The email paragraph. + */ +function create_email_paragraph($email_index) { + $email_address = 'service_location_contact' . $email_index + 1 . '@example.com'; + $email = Paragraph::create([ + 'type' => 'email_contact', + 'field_email_address' => $email_address, + 'field_email_label' => 'Email ' . $email_index + 1, + ]); + return $email; +} + +/** + * Randomly choose a true, false, or null value. + * + * @return string + * The true, false, or null value. + */ +function choose_random_true_false_null() { + $true_false_null = [ + '1', + '0', + NULL, + ]; + $random_true_false_null = $true_false_null[array_rand($true_false_null)]; + return $random_true_false_null; + +} + +/** + * Randomly choose whether online scheduling is available. + * + * @return string + * The online scheduling availability choice. + */ +function choose_random_online_scheduling_avail_option() { + $online_scheduling_avail_options = [ + 'yes', + 'no', + NULL, + ]; + $random_online_scheduling_avail_option = $online_scheduling_avail_options[array_rand($online_scheduling_avail_options)]; + return $random_online_scheduling_avail_option; +} + +/** + * Randomly choose an office visit option. + * + * @return string + * The office visit option. + */ +function choose_random_office_visit() { + $office_visits_options = [ + 'no', + 'yes_appointment_only', + 'yes_walk_in_visits_only', + 'yes_with_or_without_appointment', + NULL, + ]; + $random_office_visit = $office_visits_options[array_rand($office_visits_options)]; + return $random_office_visit; +} + +/** + * Randomly choose a virtual support option. + * + * @return string + * The virtual support option. + */ +function choose_random_virtual_support() { + $virtual_support_options = [ + 'no', + 'yes_appointment_only', + 'yes_veterans_can_call', + 'virtual_visits_may_be_available', + NULL, + ]; + $random_virtual_support = $virtual_support_options[array_rand($virtual_support_options)]; + return $random_virtual_support; +} + +/** + * Randomly choose an introduction text type. + * + * @return string + * The appointment introduction text type. + */ +function choose_random_appt_intro_text_type() { + $appt_intro_text_type_options = [ + 'use_default_text', + 'customize_text', + 'remove_text', + NULL, + ]; + $random_appt_intro_text_type = $appt_intro_text_type_options[array_rand($appt_intro_text_type_options)]; + return $random_appt_intro_text_type; + +} + +/** + * Randomly choose a phone number type. + * + * @return string + * The phone number type. + */ +function choose_random_phone_number_type() { + $phone_number_types = [ + 'tel', + 'fax', + 'sms', + 'tty', + ]; + $random_phone_number_type = $phone_number_types[array_rand($phone_number_types)]; + return $random_phone_number_type; +} + +/** + * Generate a random phone number. + * + * @return string + * A phone number. + */ +function generate_random_phone_number() { + $area_code = rand(200, 989); + $prefix = rand(100, 999); + $line_number = rand(1000, 9999); + $phone_number = sprintf("%03d-%03d-%04d", $area_code, $prefix, $line_number); + return $phone_number; +} + +/** + * Add prepare for your visit to facility. + * + * @param \Drupal\node\Entity\Node $node + * The facility node. + * @param int $number_of_accordions + * The number of accordions to add. + */ +function add_prepare_for_your_visit_to_facility($node, $number_of_accordions) { + for ($i = 0; $i < $number_of_accordions; $i++) { + $prepare_for_your_visit_new = Paragraph::create([ + 'type' => 'basic_accordion', + 'field_header' => 'Prepare for your visit ' . $i + 1, + + 'field_rich_wysiwyg' => [ + 'value' => 'Prepare for your visit body ' . $i + 1, + 'format' => 'rich_text_limited', + ], + ]); + $prepare_for_your_visit_new->save(); + $node->field_prepare_for_visit->appendItem($prepare_for_your_visit_new); + } + $node->save(); +} + +/** + * Add media to facility. + * + * @param \Drupal\node\Entity\Node $node + * The facility node. + * @param int $media_id + * The media node to add. + */ +function add_media_to_facility($node, $media_id) { + // Load the media entity. + $media = Media::load($media_id); + // Check if the media entity exists and is an image. + if ($media && $media->bundle() == 'image') { + // Append the media entity to the field. + $media = \Drupal::entityTypeManager()->getStorage('media')->load($media_id); + $node->field_media->appendItem($media); + $node->save(); + } +} + +/** + * Add spotlights to facility. + * + * @param \Drupal\node\Entity\Node $node + * The facility node. + * @param int $number_of_spotlights + * The number of spotlights to add. + * @param bool $use_cta + * Whether to add a CTA to the spotlight. + */ +function add_spotlights_to_facility($node, $number_of_spotlights, $use_cta) { + for ($i = 0; $i < $number_of_spotlights; $i++) { + if ($use_cta) { + $cta = Paragraph::create([ + 'type' => 'button', + 'field_button_link' => 'https://www.google.com', + 'field_button_label' => 'Spotlight CTA ' . $i + 1, + ]); + $cta->save(); + } + else { + $cta = NULL; + } + $spotlight = Paragraph::create([ + 'type' => 'featured_content', + 'field_section_header' => 'Spotlight title ' . $i + 1, + 'field_description' => 'Spotlight body ' . $i + 1, + ]); + + $spotlight->field_cta->appendItem($cta); + $spotlight->save(); + $node->field_local_spotlight->appendItem($spotlight); + $node->save(); + } +} diff --git a/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-facilities.csv b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-facilities.csv new file mode 100644 index 0000000000..a5c75c2868 --- /dev/null +++ b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-facilities.csv @@ -0,0 +1,7 @@ +Facility name,facility_nid,field_show_banner,field_alert_type,field_dismissible_option,field_banner_title,field_banner_content,field_operating_status_facility,field_operating_status_more_info,field_prepare_for_visit (accordion),field_header,field_rich_wysiwyg,field_media (id),field_local_spotlight (featured_content),field_section_header,field_description,field_cta (button),field_button_link,field_button_label +VA Regional Benefit Satellite Office at Thomas E. Creek Department of Veterans Affairs Medical Center,4247,,,,,,NULL,,0,,,,0,,,,, +VA Regional Benefit Satellite Office at Athens VA Clinic,48915,1,information,dismiss,Banner alert headline (also known as field_banner_title) for the VBA satellite office at Athens VA Clinic,"President Lincoln's words have stood the test of time, and stand today as a solemn reminder of VA’s commitment to care for those injured in our nation's defense and the families of those killed in its service. On March 16, 2023, VA announced an updated version of its 1959 mission statement.",normal,,0,,,,0,,,,, +Pre-Discharge Site at Fort Walker,42628,0,,,,,notice,Be advised: the Fort's been swarmed by walkers.,1,,,33234,1,,,1,, +Oakland VA Regional Benefit Office,4177,0,,,,,limited,We have a lot going on right now. We will be available on a limited based.,2,,,,2,,,0,, +Reno VA Regional Benefit Office,4286,1,warning,perm,Banner alert headline (also known as field_banner_title) for the VBA Regional office in Reno,"The new mission statement acknowledges all who have served in our nation’s military, as well as Veteran families, caregivers, and survivors. VA serves more than 50,000 Veteran caregivers and more than 600,000 Veteran survivors. Additionally, VA serves more than 600,000 women Veterans, the fastest growing cohort of Veterans.",closed,The office is temporary closed due to a strain of the fireplace flu. We will let you know when the smoke clears.,3,,,29430,2,,,2,, +Philadelphia VA Regional Benefit Office,3968,0,,,,,normal,,1,,,26862,1,,,1,, diff --git a/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-service-regions.csv b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-service-regions.csv new file mode 100644 index 0000000000..923785c35a --- /dev/null +++ b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-service-regions.csv @@ -0,0 +1,3 @@ +VA Service name,VA service (field_service_name_and_descripti) tid,Section name,Section (field_administration) tid,VBA facilities in this region,(field_vba_region_facility_list),Number of service locations,field_office_visits,field_virtual_support,field_appt_intro_text_type,field_appt_intro_text_custom,field_use_facility_phone_number,# of add'l phones (field_other_phone_numbers),field_phone_number_type,Create an extention for field_phone_extension,field_online_scheduling_avail,field_clinic_name,field_building_name_number,field_wing_floor_or_room_number,field_use_facility_address,field_hours (facility hours = 0; specific hours = 2; do not specify = 0),field_office_hours (case statement),field_additional_hours_info,field_use_main_facility_phone,# of phone (field_phone),type ,Create an extension for field_phone_extension,# of field_email_contacts,Service region name (title),Primary VBA facility,Primary VBA facility target nid +Home loans,1131,Philadelphia VA Regional Benefit Office,1057,"Philadelphia VA Regional Benefit Office, Oakland VA Regional Benefit Office","3968,4177",1,null,virtual_visits_may_be_available,null,,0,1,tel,1,yes,Office of Home Loans,,,0,0,,,null,3,tel,1,2,Philadelphia home loan service region,Philadelphia VA Regional Benefit Office,3968 +Veterans pension,1130,Reno VA Regional Benefit Office,1092,"Reno VA Regional Benefit Office, Pre-Discharge Site at Fort Walker","4286,42628",2,yes_walk_in_visits_only,no,use_default_text,,1,8,tty,0,yes,Office of Home Loans,Home loans buiding,Room 3,1,1,,,0,1,tel,1,3,Reno Veterans pension service region,Reno VA Regional Benefit Office,4286 diff --git a/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-services.csv b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-services.csv new file mode 100644 index 0000000000..d15f0030e9 --- /dev/null +++ b/scripts/content/vacms-17969/VACMS-17969-vba-test-data-source-services.csv @@ -0,0 +1,19 @@ +Facility (field_office),facility_nid,Section,section_tid,Service Name,service_tid,Number of service locations (field_service_location),field_office_visits,field_virtual_support,field_appt_intro_text_type,field_appt_intro_text_custom,field_use_facility_phone_number,# of add'l phones (field_other_phone_numbers),field_phone_number_type,Create an extention for field_phone_extension,field_online_scheduling_avail,field_clinic_name,field_building_name_number,field_wing_floor_or_room_number,field_use_facility_address,field_hours (facility hours = 0; specific hours = 2; do not specify = 1),field_office_hours (case statement),field_additional_hours_info,field_use_main_facility_phone,# of phone (field_phone),type ,Create an extension for field_phone_extension,# of field_email_contacts +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Benefit letters and decision letters,1142,1,null,no,use_default_text,,1,0,tel,0,yes,,,,1,0,,,0,1,tel,1,0 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Burials and memorials,1143,2,no,yes_appointment_only,customize_text,Test text,0,1,tel,1,no,Office of Burials and Memorials,,,0,2,hours_24_7,,1,2,tel,0,1 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Careers and employment,1169,3,yes_appointment_only,yes_veterans_can_call,remove_text,,null,2,tel,0,null,,Careers building,,1,1,,,null,3,fax,1,2 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Direct deposit information,1170,1,yes_walk_in_visits_only,virtual_visits_may_be_available,null,,null,3,fax,0,null,,,West wing,0,0,,Come by any time.,1,4,sms,0,3 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Disability compensation,1144,2,yes_with_or_without_appointment,null,use_default_text,,0,4,sms,0,no,,Disability compensation building,1st floor,0,2,hours_mf8_4,After hours available by appointment.,1,5,tty,0,4 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Education benefits for family members,1145,3,null,yes_appointment_only,customize_text,Test text,1,5,fax,0,yes,,,,1,1,,,null,0,null,null,5 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Education benefits for Veterans,1146,1,no,yes_veterans_can_call,remove_text,,0,6,tel,0,no,Office of Education Benefits,Education building,Room 123,0,0,,Operators are standing by 24/7.,0,0,null,null,1 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Grief and bereavement counseling,1006,2,yes_appointment_only,virtual_visits_may_be_available,null,,null,7,sms,0,null,,,,1,2,hours_12a_12a,,1,3,tel,1,2 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Home loans,1131,3,yes_walk_in_visits_only,no,use_default_text,,1,8,tty,0,yes,Office of Home Loans,,,1,1,,,0,1,tel,1,3 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Homeless Veteran care,39,1,yes_with_or_without_appointment,null,customize_text,Test text,null,9,tel,1,yes,,Homeless Veteran care building,,0,0,,,1,2,tel,0,4 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Life Insurance,1147,2,null,yes_veterans_can_call,remove_text,,1,0,sms,0,yes,,,East wing,1,2,hours_closed,Come by any time.,null,3,tel,1,5 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Military records,1148,3,no,virtual_visits_may_be_available,null,,0,1,tty,0,no,,Military records building,Sub-bassement B,0,1,,After hours available by appointment.,0,4,sms,0,0 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Military sexual trauma-related claims,1171,1,yes_appointment_only,no,use_default_text,,0,2,tel,0,null,,,,0,0,,,0,5,fax,0,5 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Pre-discharge claims,1172,2,yes_walk_in_visits_only,yes_appointment_only,customize_text,Test text,1,0,tty,0,null,Office of Pre-discharge claims,Pre-discharge claims building,Room 321,1,2,hours_mf8_4,Operators are standing by 24/7.,1,1,tel,1,4 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Returning service member care,55,3,yes_with_or_without_appointment,yes_veterans_can_call,remove_text,,null,0,fax,0,no,,,,1,1,,,0,2,tel,0,3 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Veteran readiness and employment programs,94,1,null,virtual_visits_may_be_available,null,,0,1,tel,1,yes,Office of VRE,,,0,0,,,null,3,tel,1,2 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,Veterans pension,1130,2,no,no,use_default_text,,null,1,fax,0,no,,Pension building,,0,2,hours_mf8_4,,1,4,sms,0,1 +Philadelphia VA Regional Benefit Office,3968,Philadelphia VA Regional Benefit Office,1057,VetSuccess on Campus,1173,3,yes_appointment_only,yes_appointment_only,customize_text,Test text,1,0,tel,1,null,,,North wing,1,1,,Come by any time.,0,5,tty,0,0 diff --git a/tests/cypress/integration/features/content_type/facilities/vet_center/vet_center_facility_service.feature b/tests/cypress/integration/features/content_type/facilities/vet_center/vet_center_facility_service.feature index 9f2c81dec2..86bb5995af 100644 --- a/tests/cypress/integration/features/content_type/facilities/vet_center/vet_center_facility_service.feature +++ b/tests/cypress/integration/features/content_type/facilities/vet_center/vet_center_facility_service.feature @@ -15,6 +15,40 @@ Scenario: Editors should not be able to rename a Vet Center - Facility Service And I click the "Unlock" link And I click the "Confirm break lock" button +Scenario: Editors should be able to archive an optional Vet Center - Facility Service + Given I am logged in as a user with the roles "content_creator_vet_center, content_publisher, content_editor" + # Escanaba Vet Center + And my workbench access sections are set to "392" + # Escanaba Vet Center - Workshops and Classes + When I am at "node/19570/edit" + And I scroll to element "select#edit-moderation-state-0-state" + Then an option with the text "Archived" from dropdown with selector "select#edit-moderation-state-0-state" should be visible + Then I scroll to position "bottom" + And I click the "Unlock" link + And I click the "Confirm break lock" button + +Scenario: Editors should be not able to archive a required Vet Center - Facility Service + Given I am logged in as a user with the roles "content_creator_vet_center, content_publisher, content_editor" + # Escanaba Vet Center + And my workbench access sections are set to "392" + # Escanaba Vet Center - Addiction + When I am at "node/17597/edit" + And I scroll to element "select#edit-moderation-state-0-state" + Then an option with the text "Archived" from dropdown with selector "select#edit-moderation-state-0-state" should not be visible + Then I scroll to position "bottom" + And I click the "Unlock" link + And I click the "Confirm break lock" button + +Scenario: Admins should be able to archive a required Vet Center - Facility Service + Given I am logged in as a user with the "administrator" role + # Escanaba Vet Center - Suicide prevention + When I am at "node/17926/edit" + And I scroll to element "select#edit-moderation-state-0-state" + Then an option with the text "Archived" from dropdown with selector "select#edit-moderation-state-0-state" should be visible + Then I scroll to position "bottom" + And I click the "Unlock" link + And I click the "Confirm break lock" button + Scenario: Administrators should be able to rename a Vet Center - Facility Service Given I am logged in as a user with the "administrator" role # Escanaba Vet Center - Telehealth