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

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



DECLARE 

  e_dir_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_dir_exists, -31003);

  e_does_not_exists EXCEPTION;
  PRAGMA EXCEPTION_INIT(e_does_not_exists , -31001);

  result boolean;
  
BEGIN

  BEGIN

    result := DBMS_XDB.createfolder('/public/xxas/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/');
    result := DBMS_XDB.createfolder('/public/xxas/emp/view/');

  EXCEPTION
    WHEN e_dir_exists THEN
      NULL;
  END;

  
  BEGIN

    DBMS_XDB.DeleteResource('/public/xxas/emp/view/vacancyoffercreate.xml');

  EXCEPTION
    WHEN e_does_not_exists THEN
      NULL;
  END;

  
  result := DBMS_XDB.createresource('/public/xxas/emp/view/vacancyoffercreate.xml',
'<View title="Vacany offer" defaultFormHandler="xxas_vacancy_pkg.commit_form_data">

  <CreateFields>

    <Container id="BASIC_GRP" label="Offer Basic Details">
	  <Hidden id="ASSIGNMENT_ID"/>
	  <Hidden id="OFFER_ID"/>
	  <Hidden id="VACANCY_ID"/>
	  <Hidden id="TRANSACTION_ID"/>
      <Poplist id="STATUS_CODE" label="Offer Status" listProvider="LOOKUP_TYPE:IRC_OFFER_STATUSES" enabled="false"/>
      <Number id="OFFER_VERSION" label="Version" visible="false"/>
      <Poplist id="LATEST_OFFER" label="Latest Offer" listProvider="LOOKUP_TYPE:YES_NO" visible="false"/>
      <TextInput id="DISCRETIONARY_JOB_TITLE" label="Discretionary Job Title" required="false" />
      <Poplist id="BUSINESS_GROUP_ID" label="Business Group" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Business_Groups" visible="true" enabled="false"/>
      <Combolist id="POSITION_ID" label="Position" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Positions" longlist="true" enabled="false"/>
      <Combolist id="JOB_ID" label="Job" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Jobs" longlist="true" enabled="false"/>
      <Combolist id="GRADE_ID" label="Grade" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Grades" longlist="true" enabled="false"/>
      <Combolist id="ORGANIZATION_ID" label="Organization" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Organizations" longlist="true" enabled="false" required="true"/>
      <Combolist id="LOCATION_ID" label="Location" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Locations" longlist="true" enabled="false"/>
      <Combolist id="SUPERVISOR_ID" label="Manager" listProvider="REST:peoplesearch" longlist="true" enabled="false"/>
      <Combolist id="RECRUITER_ID" label="Recruiter" listProvider="REST:peoplesearch" longlist="true" enabled="false"/>
      <Poplist id="EMPLOYMENT_CATEGORY" label="Employment Status" listProvider="LOOKUP_TYPE:EMP_CAT"/>
      <Time id="TIME_NORMAL_START" label="Normal Start Time"/>
      <Time id="TIME_NORMAL_FINISH" label="Normal Finish Time"/>
      <Number id="NORMAL_HOURS" label="Exact Work Hours" refreshOnChange="true"/>
      <Poplist id="ASG_FREQUENCY" label="Work Hours Frequency" listProvider="LOOKUP_TYPE:FREQUENCY"/>
      <Flexfield applicationId ="800" descriptiveFlexfieldName="PER_ASSIGNMENTS"/>
      <Date id="EXPIRY_DATE" label="Expiry Date"/>
      <Date id="PROPOSED_START_DATE" label="Proposed Start Date"/>
      <Poplist id="OFFER_OUT_OF_VACANCY" label="Offer Outside of This Vacancy" value="N" listProvider="LOOKUP_TYPE:YES_NO" enabled="false"/>
      <Flexfield applicationId = "800" descriptiveFlexfieldName="IRC_OFFERS"/>
    </Container>
  
    <Container id="SALARY_GRP" label="Salary Information">
      <Hidden id="PAY_PROPOSAL_ID"/>
      <Poplist id="PAY_BASIS_ID" label="Salary Basis" listProvider="VALUE_SET_NAME:XXAS_Recruiting_Pay_Bases" required="true" refreshOnChange="true"/>
      <Number id="PROPOSED_SALARY" label="Proposed Salary" required="true" refreshOnChange="true"/>
      <Poplist id="CURRENCY" label="Currency" enabled="false" listProvider="VALUE_SET_NAME:Applaud Currencies"/>
      <TextInput id="GRADE_RANGE" label="Grade Range" enabled="false"/>
      <TextInput id="COMPARATIO" label="Comparatio" enabled="false"/>
      <TextInput id="QUARTILE" label="Quartile" enabled="false"/>
      <TextInput id="ANNUALIZED_FTE_SALARY" label="Annualized FTE Salary" enabled="false"/>
      <TextInput id="ANNUALIZED_SALARY" label="Annualized Salary" enabled="false"/>
    </Container>
    
    
    <Container id="ATTACH_GRP" label="Attachments" visible="false">
      <MultiRow id="ATTACHMENTS" createAllowed="true" createLabel="Add Attachment" xdbUri="/public/xxas/emp/view/attach.xml" />
    </Container>
 
  </CreateFields>

</View>' );
xxas_forms_pkg.update_forms_resource('/public/xxas/emp/view/vacancyoffercreate.xml'); 
END;
/
COMMIT;
EXIT;
