<apex:page standardController="Opportunity" id="Lpti_New_Opportunity">
<apex:includeScript value="{!URLFOR($Resource.JQuery, 'jquery1.9.1.min.js')}"/>
<script>
$(document).ready(function(){
StageChangeEvent();
$('[Id$=iptProbability]').parent().append('<div style="position: absolute;background: gray;min-height: 22px;width: 156px;margin-top: -24px;opacity: 0.2;"></div>');
FillCloseDate();
});
function FillCloseDate()
{
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = date.(mm+'/'+dd+'/'+yyyy);
$('[Id$=closedate]').val(today);
}
function StageChangeEvent(){
$('[Id$=iptStage]').change(function(){
if($('[Id$=iptStage]').val()=="Closed Won"){
$('[Id$=iptProbability]').val(100);
$('[Id$=iptNumberOfInstallment]').attr('disabled',false);
}else if($('[Id$=iptStage]').val()=="Proposal/First Quote sent"){
$('[Id$=iptProbability]').val(40);
DisableInastllment();
}else if($('[Id$=iptStage]').val()=="Transferred - B2B"){
$('[Id$=iptProbability]').val(50);
DisableInastllment();
}else if($('[Id$=iptStage]').val()=="Negotiation/Review"){
$('[Id$=iptProbability]').val(60);
DisableInastllment();
}else if($('[Id$=iptStage]').val()=="Closed Lost"){
$('[Id$=iptProbability]').val(0);
DisableInastllment();
}else if($('[Id$=iptStage]').val()==""){
$('[Id$=iptProbability]').val(0);
}
});
}
</script>
<apex:pageMessages ></apex:pageMessages>
<apex:form id="mainFrm">
<apex:pageBlock id="pbMain">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageblockSection title="Opportunity Information" id="pbsOppInfo" >
<apex:outputField value="{!Opportunity.Ownerid}" id="ow" rendered="{!$
CurrentPage.parameters.id!=null}" />
<apex:repeat id="rptBasicInfo" value="{!$ObjectType.Opportunity.FieldSets.OpportunityInfo}" var="inOppInfo">
<apex:inputField id="infldBasicInfo" value="{!Opportunity[inOppInfo]}"></apex:inputField>
</apex:repeat>
<apex:inputField value="{!Opportunity.OppContact__c}" id="iptContact" rendered="{!if($
CurrentPage.Parameters.id !='' && Opportunity.OppContact__c != '',true,false)}"/>
<apex:inputField value="{!Opportunity.StageName}" id="iptStage" required="true"/>
<!-- <apex:inputField value="{!Opportunity.Probability}" id="iptProbability"/> -->
</apex:pageblockSection>
<div style="display:none">
<apex:inputField value="{!Opportunity.Probability}" id="iptProbability"/>
<apex:inputField id="closedate" value="{!Opportunity.closedate}"/>
</div>
<apex:pageblockSection title="Holiday Details" >
<apex:repeat id="rptHolidayInfo" value="{!$ObjectType.Opportunity.FieldSets.Holiday_Details}" var="inHoliday">
<apex:inputField id="inHolidayInfo" value="{!Opportunity[inHoliday]}" required="{!OR(inHoliday.required, inHoliday.dbrequired)}"></apex:inputField>
</apex:repeat>
</apex:pageblockSection>
<!-- <apex:pageBlockSection title="OpportunityInformation" id="pbsOppInfo">
<apex:outputText value="{!$User.FirstName} {!$User.LastName}" label="Opportunity owner" rendered="{!$
CurrentPage.parameters.id==null}" style="margin-left:10px;"/>
<apex:inputField value="{!Opportunity.Name}" id="iptname" required="true"/>
<apex:inputField value="{!Opportunity.Accountid}" id="iptSalutation" />
<apex:inputField value="{!Opportunity.OppContact__c}" id="idcontact" required="true"/>
<apex:inputField value="{!Opportunity.Type}" id="ipttype" required="true"/>
<apex:inputField value="{!Opportunity.Lpti_Group_Size__c}" id="iptgroupsource" required="true"/>
<apex:inputField value="{!Opportunity.LeadSource}" id="iptLeadSource" />
<apex:inputField value="{!Opportunity.Amount}" id="iptAmount" />
<apex:inputField value="{!Opportunity.CloseDate}" id="iptclosedate" required="true"/>
<apex:inputField value="{!Opportunity.StageName}" id="ipstage" required="true"/>
<apex:inputField value="{!Opportunity.Probability}" id="iptProbability"/>
<apex:inputField value="{!Opportunity.Lpti_Mobile_Number__c}" id="iptCompany"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Holiday Details">
<apex:inputField value="{!Opportunity.Lpti_Business__c}" id="ipbusiness" required="true" />
<apex:inputField value="{!Opportunity.Lpti_Product__c}" id="ipproduuct" required="true"/>
<apex:inputField value="{!Opportunity.Lpti_Tour_Type__c}" id="iptour" required="true"/>
<apex:inputField value="{!Opportunity.Lpti_Circuit_Program__c}" id="iptcircuit" required="true"/>
<apex:inputField value="{!Opportunity.Lpti_Level__c}" id="iptlevel" required="true"/>
<apex:inputField value="{!Opportunity.Lpti_Duration_of_Travel__c}" style="width:150px;" id="iptDestinationLocation" />
<apex:inputField value="{!Opportunity.TUI_Month_of_travel__c}" id="iptReg" />
<apex:inputField value="{!Opportunity.Lpti_Children_6_12__c}" id="ipchildren" />
<apex:inputField value="{!Opportunity.Lpti_Children_0_5__c}" id="iptchildren5" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Passenger Details">
<apex:inputField value="{!Opportunity.Lpti_Duration_of_Travel__c}" style="width:150px;" id="iptDestinationLocation" />
<apex:inputField value="{!Opportunity.TUI_Month_of_travel__c}" id="iptReg" />
<apex:inputField value="{!Opportunity.Lpti_Children_6_12__c}" id="ipchildren" />
<apex:inputField value="{!Opportunity.Lpti_Children_0_5__c}" id="iptchildren5" />
</apex:pageBlockSection> -->
<apex:pageBlockSection title="Additional Information">
<apex:inputField value="{!Opportunity.Lpti_Lost_Reasons__c}" id="ipbaddress" style="width:150px;" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>