/* $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_PERF_REVIEW_TEMPL_LIST_V
AS
SELECT 'flexible' "type",
        xprtv.perf_review_template_id "PERF_REVIEW_TEMPLATE_ID",
        xprtv.perf_review_template_id "id",
        xprtv.title "TEMPLATE_TITLE",
        xprtv.template_usage "TEMPLATE_USAGE",
        xprtv.description "DESCRIPTION",
        decode(xprtv.enabled_flag
              ,'N'
              ,'<font color="'
              || xxas_rslt_cache_pkg.resolve_color_name('orange')
              || '">❗'
              || xxas_util_pkg.decode_lookup('XXAS_PERF_TEMPLATE_STATUS' ,'N')
              || '</font>') "line2",
        xprtv.title "line1",
        '<font color="'
      || xxas_rslt_cache_pkg.resolve_color_name('grey')
      || '">'
      || xprtv.description
      || '</font>' "line3",
        xprtv.enabled_flag "ENABLED",
        xprtv.questionnaire_dff_structure "QUESTIONNAIRE_DFF_STRUCTURE",
        'view-review-template' "pageId",
        xprtv.perf_review_template_id "objectId"
   FROM xxas_perf_review_templates_v xprtv
 ORDER BY xprtv.enabled_flag desc,xprtv.title asc;

BEGIN
  xxas_fnd_dictionary_pkg.add_view
   (p_application_short_name => xxas_util_pkg.app
   ,p_view_name              => 'XXAS_PERF_REVIEW_TEMPL_LIST_V'
   ,p_description            => 'Applaud Performance Review Templates List');
END;
/

COMMIT;
EXIT;

