/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2016 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

CREATE OR REPLACE VIEW xxas_page_details_v
AS
SELECT p.menu_id
      ,p.title
      ,p.title_message
      ,decode(p.title_function, null, 'N', 'Y') use_dynamic_title
      ,p.icon
      ,p.icon_color icon_color
      ,lower(xxas_rslt_cache_pkg.resolve_color_name(p.icon_color)) icon_color_hex
      ,p.title_function
      ,p.hide_title_flag
      ,p.fix_title_flag
      ,p.description
      ,p.description_message
      ,p.slug 
      ,p.object_id_format
            ,'<a href="'
       || xxas_com_rest_util_pkg.uri_from_app_route(p.slug)
       || '">'
       || xxas_com_rest_util_pkg.uri_from_app_route(p.slug)|| decode(p.object_id_format,NULL,'','/' || p.object_id_format)
       || '</a>' href
      ,upper(p.layout) layout
      ,CASE WHEN p.published_flag = 'Y' THEN
                 'PUBLISHED'
            ELSE
                 'UNPUBLISHED'
       END status
      ,p.context_handler
      ,p.background_image
      ,p.background_image_repeat     
      ,p.menu_name
      ,p.sub_menu_id
      ,p.sub_menu_name
      ,p.seeded_page_flag
      ,p.internal_page_flag
      ,decode(hideif,null,'N','Y') RESTRICT_DEVICE
      ,xxas_page_pkg.get_hideif_restrictions(p.hideif) RESTRICTIONS
      ,p.unclosable_modal
FROM   xxas_pages_v p;

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PAGE_DETAILS_V'
   ,p_description            => 'Applaud Page Details');
END;
/

COMMIT;
EXIT;

