Advertisement
hsianghui

IS3106 Lab4 (manageCustomer.xhtml)

Oct 29th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 5.53 KB | None | 0 0
  1. <?xml version='1.0' encoding='UTF-8' ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml"
  4.      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  5.      xmlns:h="http://xmlns.jcp.org/jsf/html"
  6.      xmlns:f="http://xmlns.jcp.org/jsf/core">
  7.  
  8.     <body>
  9.  
  10.         <ui:composition template="./layout/default2.xhtml">
  11.             <f:metadata>
  12.                 <f:viewParam name="cId" value="#{customerManagedBean.cId}" />
  13.                 <f:event type="preRenderView" listener="#{customerManagedBean.loadSelectedCustomer}"/>
  14.             </f:metadata>
  15.            
  16.             <ui:define name="title">
  17.                 Manage Customer
  18.             </ui:define>
  19.  
  20.             <ui:define name="content">
  21.                 <!-- Content Header (Page header) -->
  22.                 <section class="content-header">
  23.                     <h1>
  24.                         Manage Customer
  25.                     </h1>
  26.                     <ol class="breadcrumb">
  27.                         <li><a href="./"><i class="fa fa-dashboard"></i> Home</a></li>
  28.                         <li class="active">#{customerManagedBean.selectedCustomer == null ? 'Create New Customer' : 'Edit Customer'}</li>
  29.                     </ol>
  30.                 </section>
  31.  
  32.                 <!-- Main content -->
  33.                 <section class="content">
  34.                     <!-- Horizontal Form -->
  35.                     <div class="box box-info">
  36.                         <div class="box-header with-border">
  37.                             <h3 class="box-title">#{customerManagedBean.selectedCustomer == null ? 'Create New Customer' : 'Edit Customer'}</h3>
  38.                         </div>
  39.                         <!-- /.box-header -->
  40.                         <!-- form start -->
  41.                         <h:form class="form-horizontal">
  42.                             <div class="box-body">
  43.                                 <div class="form-group #{inputName.valid ? '' :'has-error'}">
  44.                                     <label for="inputName" class="col-sm-2 control-label">Name</label>
  45.  
  46.                                     <div class="col-sm-10">
  47.                                         <h:inputText binding="#{inputName}" id="inputName" value="#{customerManagedBean.name}" required="true" requiredMessage="Name is required" class="form-control" />
  48.                                         <h:message for="inputName" class="help-block"/>
  49.                                     </div>
  50.                                 </div>
  51.                                 <div class="form-group">
  52.                                     <label class="col-sm-2 control-label">Gender</label>
  53.  
  54.                                     <div class="col-sm-10">
  55.                                         <h:selectOneMenu value="#{customerManagedBean.gender}" class="form-control">
  56.                                             <f:selectItem itemValue = "1" itemLabel = "Female" />
  57.                                             <f:selectItem itemValue = "2" itemLabel = "Male" />
  58.                                         </h:selectOneMenu>
  59.                                     </div>
  60.                                 </div>
  61.                                 <div class="form-group #{inputDOB.valid ? '' :'has-error'}">
  62.                                     <label class="col-sm-2 control-label">Date of Birth <br />(dd/mm/yyyy)</label>
  63.  
  64.                                     <div class="col-sm-10">
  65.                                         <div class="input-group date">
  66.                                             <div class="input-group-addon">
  67.                                                 <i class="fa fa-calendar"></i>
  68.                                             </div>                                          
  69.                                             <h:inputText binding="#{inputDOB}" id="inputDOB" value="#{customerManagedBean.dob}" required="true" requiredMessage="DOB is required" converterMessage="Format should be dd/mm/yyy" class="form-control pull-right datepicker">
  70.                                                 <f:convertDateTime pattern="dd/MM/yyy" />
  71.                                             </h:inputText>
  72.                                         </div>
  73.                                         <h:message for="inputDOB" class="help-block"/>
  74.                                     </div>
  75.                                 </div>
  76.                             </div>
  77.                             <!-- /.box-body -->
  78.                             <div class="box-footer">
  79.                                 <h:button value="Cancel" class="btn btn-default" outcome="searchCustomers2" />
  80.                                 <h:commandButton value="Submit" class="btn btn-info pull-right" actionListener="#{customerManagedBean.submitAction}" action="searchCustomers2?faces-redirect=true"/>
  81.                             </div>
  82.                             <!-- /.box-footer -->
  83.                         </h:form>
  84.                     </div>
  85.                     <!-- /.box -->
  86.                 </section>
  87.                 <!-- /.content -->
  88.  
  89.             </ui:define>
  90.  
  91.             <ui:define name="script">
  92.                 <script>
  93.                     //Date picker
  94.                     $('.datepicker').datepicker({
  95.                         autoclose: true,
  96.                         format: 'dd/mm/yyyy',
  97.                         orientation: 'bottom left'
  98.                     })
  99.                 </script>
  100.             </ui:define>
  101.  
  102.         </ui:composition>
  103.  
  104.     </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement