Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class contact_list_controller {
- public String user_contact_EmailID ='[email protected]';
- public List<Contact> contacts { get; set; }
- public List<Case> cases{get;set;}
- public Case detailsCase{get;set;}
- public Contact contact_case {get; set;}
- public Case newcases {get; set;}
- public Case CommentCase{get;set;}
- public CaseComment case_comment {get; set;}
- public boolean displayPopup {get; set;}
- public boolean case_comment_popup {get; set;}
- public String Case_ID;
- public contact_list_controller()
- {
- contact_case = new Contact();
- newcases = new Case();
- detailscase = new Case();
- case_comment = new CaseComment();
- try{
- contacts=[Select ID,name,phone,mobilephone,fax,email,birthdate,mailingcity,mailingstate,mailingcountry,homephone from contact where email = :user_contact_EmailID];
- cases=[Select casenumber ,Description,isclosed, isdeleted,priority,status,subject,type,reason,origin,CreatedDate from Case where case.contactid IN (Select ID from contact where email = :user_contact_EmailID) ORDER BY casenumber DESC limit 10];
- }
- catch (Exception ex) {
- System.debug(LoggingLevel.Error, 'contact_list_controller.save() Exception: ' + ex);
- }
- }
- //Function which save's the new case
- public void Save() {
- try{
- contact_case = [select Id from contact where email =:user_contact_EmailID];
- newcases.contactid = contact_case.Id;
- insert newcases;
- displayPopup = false;
- }
- catch (Exception ex) {
- System.debug(LoggingLevel.Error, 'contact_list_controller.save() Exception: ' + ex);
- }
- finally{
- newcases = new Case();
- }
- }
- // function to close the popup
- public void ClosePopup(){
- displayPopup=false;
- }
- //function to close casecomment
- public void Casecomment_close(){
- case_comment_popup = false;
- }
- // function to show the popup
- public void showPopup() {
- displayPopup = true;
- }
- public void case_detail(){
- try{
- Case_ID = Apexpages.currentPage().getParameters().get('myParam');
- detailscase=[select casenumber,Description,isclosed, isdeleted,priority,status,subject,type,reason,origin,CreatedDate from case where casenumber= :Case_ID];
- displayPopup = true;
- }
- catch (Exception ex) {
- System.debug(LoggingLevel.Error, 'contact_list_controller.save() Exception: ' + ex);
- }
- }
- public void casecomment(){
- case_comment_popup = true;
- }
- public void save_casecomment(){
- try{
- CommentCase = [Select ID,priority,origin,type,status,reason,subject,Description,isclosed from Case where casenumber= :Case_ID];
- if(CommentCase.ID!= null){
- case_comment.parentid = CommentCase.Id;
- insert case_comment;
- case_comment_popup = false;
- }
- }
- catch (Exception ex) {
- System.debug(LoggingLevel.Error, 'contact_list_controller.save() Exception: ' + ex);
- }
- finally{
- case_comment = new CaseComment();
- }
- }
- }
- <apex:page showheader="false">
- <style>
- <!-- CSS for displaying detail and chat side by side -->
- #wr {margin: 0 auto;}
- #leftdetail, #rightchat { border: 1px solid white;float: left;min-height: 450px;color: white;margin-left:2%;}
- #leftdetail {margin-left:2%;min-width:70%;max-width:70%}
- #rightchat {width:25%;margin-right:2%}
- </style>
- <style type="text/css">
- .custPopup{
- background-color: white;
- border-width: 2px;
- border-style: solid;
- z-index: 9999;
- left: 50%;
- padding:10px;
- position: absolute;
- /* These are the 3 css properties you will need to change so the popup
- displays in the center of the screen. First set the width. Then set
- margin-left to negative half of what the width is. You can add
- the height property for a fixed size pop up if you want.*/
- width: 600px;
- margin-left: -250px;
- top:100px;
- }
- .popupBackground{
- background-color:black;
- opacity: 0.20;
- filter: alpha(opacity = 20);
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- left: 0;
- z-index: 9998;
- }
- </style>
- <div id="wr">
- <div id="leftdetail">
- <!--Tab Panel -->
- <c:Tabpanel >
- <!--Contact Tab for getting the Contact details-->
- <c:Tab title="Contact">
- <apex:pageBlock title="Contact Detail">
- <apex:repeat value="{!contacts}" var="contact">
- <table cellpadding="15">
- <tr>
- <td><apex:outputText value="Contact Name : {!contact.Name}"/> </td>
- </tr>
- <tr>
- <td><apex:outputText value="Phone : {!contact.phone}"/></td>
- <td><apex:outputText value="Email : {!contact.email}"/></td>
- <td><apex:outputText value="Fax : {!contact.Fax}"/> </td>
- </tr>
- <tr>
- <td><apex:outputText value="Mobile : {!contact.Mobilephone}"/></td>
- <td><apex:outputText value="Home Phone :{!contact.Homephone}"/></td>
- <td><apex:outputText value="Birthdate : {!contact.Birthdate}"/></td>
- </tr>
- <tr>
- <td><apex:outputText value="City : {!contact.MailingCity}"/></td>
- <td><apex:outputText value="State : {!contact.MailingState}"/></td>
- <td><apex:outputText value="Country : {!contact.MailingCountry}"/></td>
- </tr>
- </table>
- </apex:repeat>
- </apex:pageBlock>
- </c:Tab>
- <!--Case tab which contain the case details for the respective contact -->
- <c:Tab title="Cases">
- <apex:form >
- <apex:pageBlock title="Case Info">
- <!-- Adding New case for the respective contact-->
- <apex:commandButton value="New Case" action="{!showPopup}" rerender="tstpopup"/>
- <apex:outputPanel id="tstpopup">
- <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
- <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
- <apex:pageBlock title="New Case">
- <apex:repeat value="{!contacts}" var="contact">
- <table cellpadding="15">
- <tr>
- <td><apex:outputText value="Contact Name : {!contact.Name}"/> </td>
- </tr>
- </table>
- </apex:repeat>
- <apex:pageBlockSection >
- <apex:inputField value="{!newcases.Priority}" />
- <apex:inputField value="{!newcases.Origin}" />
- <apex:inputField value="{!newcases.Type}" />
- <apex:inputField value="{!newcases.Status}" />
- <apex:inputField value="{!newcases.reason}" />
- <apex:inputField value="{!newcases.subject}" />
- </apex:PageBlockSection>
- <apex:PageBlockSection >
- <apex:inputField value="{!newcases.Description}" style="width:450px"/>
- </apex:pageBlockSection>
- </apex:pageBlock>
- <apex:commandButton value="Cancel" action="{!closePopup}" rerender="tstpopup"/>
- <!--saving the New case Detail -->
- <apex:CommandButton value="Save" action="{!Save}" rerender="tstpopup"/>
- </apex:outputPanel>
- </apex:outputPanel>
- <!-- to display the list of cases for the respective contact-->
- <apex:pageBlockTable value="{!cases}" var="case">
- <apex:column headerValue="Case Number">
- <!-- onclick CaseID it will display the respective case detail-->
- <apex:commandLink action="{!case_detail}" rerender="case_detai"> {!case.casenumber}
- <apex:param name="myParam" value="{!case.casenumber}"/>
- </apex:commandLink>
- <apex:outputPanel id="case_detai">
- <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
- <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
- <apex:PageBlock title="Case detail">
- <apex:repeat value="{!detailscase}" var="detailscases">
- <apex:PageBlock title="Subject:{!detailscases.subject}" >
- <table cellpadding="20">
- <tr>
- <td><apex:outputText value="Case ID : {!detailscases.casenumber}"/> </td>
- <td><apex:outputText value="Case Status:{!detailscases.status}"/> </td>
- <td><apex:outputText value="Priority :{!detailscases.priority}"/> </td>
- <td><apex:outputText value="Case Origin :{!detailscases.origin}"/> </td>
- </tr>
- <tr>
- <td><apex:outputText value="Created:{!detailscases.isclosed}"/> </td>
- <td><apex:outputText value="Type:{!detailscases.type}"/> </td>
- <td><apex:outputText value="Case Reason:{!detailscases.reason}"/></td>
- </tr>
- <tr>
- <td><apex:outputText value="Description: {!detailscases.Description}"/></td>
- </tr>
- </table>
- </apex:PageBlock>
- </apex:repeat>
- </apex:PageBlock>
- <!-- for cancel/close the casedetail popup-->
- <apex:commandButton value="Cancel" action="{!closePopup}" immediate="true" rerender="case_detai"/>
- <apex:commandButton value="Case Comments" action="{!casecomment}" immediate="true" rerender="case_comment"/>
- <apex:outputPanel id="case_comment">
- <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!case_comment_popup}"/>
- <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!case_comment_popup}">
- <apex:pageBlock title=" Case Comment">
- <apex:repeat value="{!detailscase}" var="detailscases">
- <table>
- <tr>
- <td><apex:outputText value="case ID:{!detailscases.casenumber}"/></td>
- </tr>
- <tr>
- <td><apex:inputField value="{!case_comment.commentbody}" style="width:550px"/> </td>
- </tr>
- </table>
- <apex:commandButton value="Cancel" action="{!Casecomment_close}" rerender="case_comment"/>
- <apex:commandButton value="Save" action="{!save_casecomment}" rerender="case_comment"/>
- <apex:param name="comment_case_number" value="{!detailscases.casenumber}"/>
- </apex:repeat>
- </apex:pageBlock>
- </apex:outputPanel>
- </apex:outputPanel>
- </apex:outputPanel>
- </apex:outputPanel>
- </apex:column>
- <apex:column value="{!case.Subject}"/>
- <apex:column value="{!case.type}"/>
- <apex:column value="{!case.status}"/>
- <apex:column value="{!case.priority}"/>
- <apex:column value="{!case.Origin}"/>
- <apex:column value="{!case.CreatedDate}"/>
- <apex:column value="{!case.isclosed}"/>
- <apex:column value="{!case.reason}"/>
- </apex:pageBlockTable>
- </apex:pageBlock>
- </apex:form>
- </c:Tab>
- <c:Tab title="Device">
- <apex:pageBlock title="Device Info">
- <apex:repeat value="{!cases}" var="case">
- <table cellpadding="10">
- </table>
- </apex:repeat>
- </apex:pageBlock>
- </c:Tab>
- <c:Tab title="Chat Detail">
- <apex:pageBlock title="Chat detail">
- </apex:pageBlock>
- </c:Tab>
- </c:Tabpanel>
- </div>
- <div id="rightchat">
- </div>
- </div>
- </apex:page>
Add Comment
Please, Sign In to add comment