<div class="content-wrapper">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1 class="text-indigo">
                        <go-back/>
                        <i class="fas fa-envelope"></i> {{createButton.heading}}
                    </h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a ng-href="{{baseurl}}/dashboard">Home</a></li>
                        <li class="breadcrumb-item"><a ng-href="{{baseurl}}/contact/list">Contact</a></li>
                        <li class="breadcrumb-item active">Add</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="card card-indigo card-outline">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-sm-12 col-md-6">
                                <div class="form-group">
                                    <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
                                        <input type="checkbox" class="custom-control-input" id="customSwitch1" ng-model="showAll">
                                        <label class="custom-control-label" ng-if="!showAll" for="customSwitch1">Show All Fields</label>
                                        <label class="custom-control-label" ng-if="showAll" for="customSwitch1">Show Only Required Fields</label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="first_name">First Name</label>
                                    <input type="text" id="first_name" class="form-control" required="required" ng-model="contact.first_name" placeholder="First Name">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="middle_name">Middle Name</label>
                                    <input type="text" id="middle_name" class="form-control" ng-model="contact.middle_name" placeholder="Middle Name">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="last_name">Last Name</label>
                                    <input type="text" id="last_name" class="form-control" ng-model="contact.last_name" placeholder="Last Name">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="description">Description</label>
                                    <textarea class="form-control" rows="2" id="description" ng-model="contact.description" placeholder="Description"></textarea>
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="department">Department</label>
                                    <input type="text" id="department" class="form-control" ng-model="contact.department" placeholder="Department">
                                </div>
                                <div class="form-group">
                                    <label for="email">Email</label>
                                    <input type="email" id="email" class="form-control" required="required" ng-model="contact.email" placeholder="Email">
                                </div>
                                <div class="form-group">
                                    <label for="phone">Phone</label>
                                    <input type="text" id="phone" class="form-control" required="required" ng-model="contact.phone" placeholder="Phone">
                                </div>
                                <div class="form-group">
                                    <label for="willActAs">Account</label>
                                    <select id="willActAs" class="form-control custom-select"
                                            ng-model="contact.acc_id" ng-options="acc.accountid as acc.acc_company_name for acc in accounts">
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-12 col-md-6" ng-if="showAll">
                                <div class="form-group" ng-if="showAll">
                                    <label for="alternate_email">Alternate Email</label>
                                    <input type="email" id="alternate_email" class="form-control" ng-model="contact.alternate_email" placeholder="Alternate Email">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="alternate_phone">Alternate Phone</label>
                                    <input type="text" id="alternate_phone" class="form-control" ng-model="contact.alternate_phone" placeholder="Alternate Phone">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="country">Country</label>
                                    <input type="text" id="country" class="form-control" ng-model="contact.country" placeholder="Country">
                                </div>

                                <div class="form-group" ng-if="showAll">
                                    <label for="address">Address</label>
                                    <textarea class="form-control" rows="2" id="address" ng-model="contact.address" placeholder="Description"></textarea>
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="city">City</label>
                                    <input type="text" id="city" class="form-control" ng-model="contact.city" placeholder="City">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="state">State</label>
                                    <input type="text" id="state" class="form-control" ng-model="contact.state" placeholder="State">
                                </div>
                                <div class="form-group" ng-if="showAll">
                                    <label for="zip">Zip/Postal Code</label>
                                    <input type="text" id="zip" class="form-control" ng-model="contact.zip" placeholder="Zip / Postal Code">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <div class="col-12">
                            <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#modal-default">Cancel</button>
                            <button type="submit" ng-click="createContact()" class="btn btn-success float-right">
                                <i class="fas {{createButton.icon}}"></i> {{createButton.text}}
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div class="modal fade" id="modal-default">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <p>Are you sure to leave this page!</p>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-indigo" data-dismiss="modal" ng-click="goTo($event,'contactList')">Proceed</button>
                </div>
            </div>
        </div>
    </div>
</div>
