<%@ page extends="oneit.servlets.jsp.JSPInclude" %>

<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>

<oneit:dynIncluded>
<%
    boolean toRedirect  =   GenericObjDF.getOrCreateObject (request, "Client", Client.REFERENCE_Client);
    Client  client      =   (Client) process.getAttribute("Client");

    if (toRedirect)
    {
        SecUser     loggedInUser    =   SecUser.getTXUser(transaction);
        CompanyUser companyUser     =   loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);

        client.setCompany(companyUser.getCompany());

        %><%@include file="/saferedirect.jsp"%><%
    }

    Debug.assertion(client != null && !toRedirect, "Invalid client in admin portal edit client");
    
    String  nextPage    =   WebUtils.getSamePageInRenderMode(request, "Page");
%>
    <div class="container-fluid">
        <div class="row content">
            <div class="main-content-area">
                <h1 class="page-title">Client</h1>        
                <oneit:form name="editClient" method="post"    enctype="multipart/form-data">
                    <div style="padding-left: 15px; padding-right: 15px;">
                        <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
                    </div>
                    <div class="form-page-area">
                        <div class="create-job">
                            <div class="assessment-criteria">
                                <div class="form-group">
                                    <label class="label-16">Details</label>                
                                </div>              
                                <div class="form-group">
                                    <oneit:label GUIName="Client Name" />
                                    <oneit:ormInput obj="<%= client %>" type="text" attributeName="ClientName"   cssClass="form-control" />                                
                                </div>
                                <div class="form-group">
                                    <oneit:label GUIName="Client Logo" />
                                    <oneit:ormInput obj="<%= client %>" type="file" attributeName="ClientLogo"  accept="image/*"/>
                                </div>
                                <div class="form-brack-line-sub"></div>
                                <div class="form-group">
                                    <label><oneit:label GUIName="Contact Email Address" /></label>
                                    <oneit:ormInput obj="<%= client %>" type="text" attributeName="Email"   cssClass="form-control" />                                
                                </div>
                                <div class="form-group row">
                                    <div class="col-md-6">
                                        <label><oneit:label GUIName="Contact First Name" /></label>
                                        <oneit:ormInput obj="<%= client %>" type="text" attributeName="ContactName"   cssClass="form-control" />                                
                                    </div>
                                    <div class="col-md-6">
                                        <label><oneit:label GUIName="Contact Last Name" /></label>
                                        <oneit:ormInput obj="<%= client %>" type="text" attributeName="ContactSurname"   cssClass="form-control" />                                
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label><oneit:label GUIName="Contact Phone Number" /></label>
                                    <oneit:ormInput obj="<%= client %>" type="text" attributeName="Phone"   cssClass="form-control" />                                
                                </div>
                                <div class="form-group row">
                                    <div class="col-md-4">
                                        <label><oneit:ormlabel  obj="<%= client %>"    field="Country" /></label>
                                        <oneit:ormEnum  obj="<%= client %>"    attributeName="Country" cssClass="form-control"/>
                                    </div>
                                    <div class="col-md-4">
                                        <label><oneit:ormlabel  obj="<%= client %>"    field="State or Province" /></label>
                                        <oneit:ormEnum  obj="<%= client %>"    attributeName="State" cssClass="form-control"/>
                                    </div>
                                    <div class="col-md-4">
                                        <label><oneit:ormlabel  obj="<%= client %>"    field="Postal Code" /></label>
                                        <oneit:ormInput obj="<%= client %>"    type="text" attributeName="PostCode"    cssClass="form-control" />      
                                    </div>
                                </div>  
                                <div class="text-center form-group">
                                    <oneit:button   value="Save Updates"    name="save" cssClass="btn btn-primary largeBtn"
                                                    requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" />
                                </div> 
                            </div>
                        </div>
                    </div>
                </oneit:form>
            </div>
        </div>
    </div>
</oneit:dynIncluded>
