<%- include('../partials/head.ejs') %>
    <!--
`body` tag options:

  Apply one or more of the following classes to to the body tag
  to get the desired effect

  * sidebar-collapse
  * sidebar-mini
-->

    <body class="hold-transition sidebar-mini">
        <div class="wrapper">
            <!-- Navbar -->
            <%- include('../partials/navigation.ejs') %>
                <!-- /.navbar -->

                <!-- Main Sidebar Container -->

                <%- include('../partials/sidebar.ejs') %>
                    <div class="pt-20">
                        <% if(errors.length> 0){ %>
                            <div class="alert alert-danger">
                                <% errors.forEach(function(error){ %>
                                    <% if(error !='' ){ %>
                                        <p>
                                            <%= error %>
                                        </p>
                                        <% }}); %>
                            </div>
                            <% } %>
                                <% if(success.length> 0){ %>
                                    <div class="alert alert-success">
                                        <p>
                                            <%=success %>
                                        </p>
                                    </div>
                                    <% } %>
                    </div>
                    <!-- Content Wrapper. Contains page content -->
                    <div class="content-wrapper">
                        <!-- Content Header (Page header) -->
                        <div class="content-header">
                            <div class="container-fluid">
                                <div class="row mb-2">
                                    <div class="col-sm-6">
                                        <h1 class="m-0">Contact Information</h1>
                                    </div><!-- /.col -->
                                    <div class="col-sm-6">
                                        <ol class="breadcrumb float-sm-right">
                                            <li class="breadcrumb-item"><a href="/admin">Home</a></li>
                                            <li class="breadcrumb-item"><a href="/admin/contact">Contact Information</a></li>
                                            <li class="breadcrumb-item active">Create</li>
                                        </ol>
                                    </div><!-- /.col -->
                                </div><!-- /.row -->
                            </div><!-- /.container-fluid -->
                        </div>
                        <!-- /.content-header -->

                        <!-- Main content -->
                        <div class="content">
                            <div class="container-fluid">
                                <div class="row">
                                    <div class="col-lg-12">
                                        <form name="edit_cms" method="POST">
                                            <div class="card">
                                                <div class="card-header">
                                                    <h3 class="card-title">Create Contact Information</h3>
                                                </div>
                                                <div class="card-body">
                                                    
                                                    <div class="form-group">
                                                        <label for="email">Email</label>
                                                        <input  type="email" class="form-control" name="email" 
                                                            value="<%= (form != null) ? form.email : '' %>"
                                                            id="email" />
                                                        <% if(validationError.length> 0){ %>
                                                            <% for(var i=0; i< validationError.length; i++) { let
                                                                obj=validationError[i]; if ("email" in obj) { %>
                                                                <div class="col-sm-12 text-danger p-0">
                                                                    <%= validationError[i].email %>
                                                                </div>
                                                        <% }}} %>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="phone">Contact</label>
                                                        <input  type="tel" class="form-control" name="phone" 
                                                            value="<%= (form != null) ? form.phone : '' %>"
                                                            id="phone" />
                                                        <% if(validationError.length> 0){ %>
                                                            <% for(var i=0; i< validationError.length; i++) { let
                                                                obj=validationError[i]; if ("phone" in obj) { %>
                                                                <div class="col-sm-12 text-danger p-0">
                                                                    <%= validationError[i].phone %>
                                                                </div>
                                                        <% }}} %>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="address">Address</label>
                                                        <textarea  type="text" class="form-control" name="address" rows="10" 
                                                         id="address" placeholder="write address ..."><%= (form != null) ? form.address : '' %></textarea>
                                                        <% if(validationError.length> 0){ %>
                                                            <% for(var i=0; i< validationError.length; i++) { let
                                                                obj=validationError[i]; if ("address" in obj) {
                                                                %>
                                                                <div class="col-sm-12 text-danger p-0">
                                                                    <%= validationError[i].address %>
                                                                </div>
                                                        <% }}} %>
                                                    </div>

                                                </div>
                                                <div class="card-footer">
                                                    <button type="submit" class="btn btn-primary">Submit</button>
                                                    <a href="/admin/contact" class="ml-2 btn btn-warning">Cancel</a>

                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <!-- /.col-md-6 -->
                                </div>
                                <!-- /.row -->
                            </div>
                            <!-- /.container-fluid -->
                        </div>
                        <!-- /.content -->
                    </div>
                    <!-- /.content-wrapper -->

                    <!-- Control Sidebar -->
                    <aside class="control-sidebar control-sidebar-dark">
                        <!-- Control sidebar content goes here -->
                    </aside>
                    <!-- /.control-sidebar -->

                    <!-- Main Footer -->

        </div>
        <!-- ./wrapper -->

        <!--  SCRIPTS -->

        <!-- jQuery -->

       
        <%- include('../partials/scripts.ejs') %>
        
    </body>