<div class="app-header bg-header-1">
    <div class="layout-fixed full-h text-center">
        <div class="full-h v-bottom-i pdB15">
            <div class="app-content-header bg-header-1">
                <div class="text-title-header-1 nowrap mgT10">New opportunity</div>
            </div>
        </div>
    </div>
    <button class="popup-close-button bg-transparent pd0-i biger-3-time" type="button" ng-click="closeTarget('#addOpportunity')"></button>
</div>
<form class="app-content" id="formAddOppotunities" name="formAddOppotunities" ng-submit="validateForm(formAddOppotunities,'Add')" novalidate="">
    <div class="app-content-inner content-pd">
        <button type="submit" id="submitFormOppotunities" style="display:none;"></button>
        <ion-scroll class="scroll-area" direction="y" has-bouncing="false" overflow-scroll="false" delegate-handle="scrollAdd" on-scroll="scrollContent('scrollAdd')">
            <div class="box-setting-4 form-field-container">
                <div class="content content-in">
                    <div class="itm">
                        <label class="label-form-field-1">Client</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <textarea autocomplete="off"
                                              class="ion-autocomplete-customer"
                                              ion-autocomplete=""
                                              item-value-key="id"
                                              item-view-value-key="fullName"
                                              items-clicked-method="clickOnItem(callback,'cus')"
                                              items-method="autoComplete(query,'cus')"
                                              items-method-value-key="items"
                                              items-removed-method="removeItemsAutocomplete(callback,'cus')"
                                              max-selected-items="1"
                                              ng-model="autocompleteList.dataCustomer"
                                              placeholder="" readonly="readonly" type="text" style="display: none"></textarea>
                                    <input type="text" name="" readonly="" ng-click="openAutocomplete('ion-autocomplete-customer')"
                                           ng-model="autocompleteViewCustomer" placeholder="Find client">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-setting-4 form-field-container">
                <div class="content content-in">
                    <div class="itm">
                        <label class="label-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.phone.$invalid }">Primary Phone Number</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.phone.$invalid }" ng-click="focusHandle($event)">
                                    <input type="text" class="h32px" name="phone" value="" ng-model="addOpportunitiesData.selectCustomer.phone" pattern=".{10,20}" id="selectCustomerPhone" placeholder="" required="" phone-input="" ng-keyup="inputPhoneNumber(addOpportunitiesData.selectCustomer.phone)">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <label class="label-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.leadsource_id.$invalid }">Lead Source</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.leadsource_id.$invalid }" ng-click="focusHandle($event)">
                                    <input type="text" placeholder="" value="" name="leadsourcesName" class="h32px">
                                    <div class="sign-r clear">
                                        <button class="bg-transparent full-h right pdR10" type="button">
                                            <svg class="h17px clr-symbol-clickable" viewBox="0 0 63.215 63.215"> <g> <g> <path fill="#1075BB" d="M59.807,15.717L31.491,43.791L3.419,15.475c-0.777-0.785-2.044-0.789-2.828-0.012c-0.784,0.777-0.789,2.044-0.012,2.827    l29.194,29.448c0.365,0.368,0.835,0.563,1.312,0.589c0.139,0.008,0.278-0.001,0.415-0.021c0.054,0.008,0.106,0.021,0.16,0.022    c0.544,0.029,1.099-0.162,1.515-0.576l29.447-29.196c0.785-0.777,0.79-2.043,0.012-2.828    C61.856,14.943,60.59,14.939,59.807,15.717z" /> </g> </g> </svg>
                                        </button>
                                    </div>
                                    <select class="field-overlay" ng-model="addOpportunitiesData.selectCustomer.leadsource_id" ng-change="setValueShowSelect('leadsourcesSelect','leadsourcesName','leadsource')" id="leadsourcesSelect" required="" name="leadsource_id">
                                        <option>Select</option>
                                        <option value="{{item.id}}" ng-repeat="item in leadsources">{{item.name}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- <div class="itm" ng-if="showTimetable"> -->
                    <div class="itm" ng-if="showTimetable">
                        <label class="label-form-field-1">Time Table</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <input class="h32px" name="last_review" placeholder="" type="text" value="{{addOpportunitiesData.selectCustomer.timetable| date: 'MM/dd/yyyy'}}">
                                    <div class="field-overlay datetime" date="" id="last_review" ion-datetime-picker="" ng-model="addOpportunitiesData.selectCustomer.timetable">
                                        {{addOpportunitiesData.selectCustomer.timetable| date: 'MM/dd/yyyy'}}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm" ng-if="showTimetable">
                        <label class="label-form-field-1">Client Comment</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <textarea ng-model="addOpportunitiesData.selectCustomer.customercomment" class="h80px"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <div class="layout-fixed input-1-group">
                            <div>
                                <label class="label-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.first_name.$invalid  }">Fisrt Name</label>
                                <div class="layout-fixed">
                                    <div>
                                        <div class="input-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.first_name.$invalid  }" ng-click="focusHandle($event)">
                                            <input type="text" class="h32px" name="first_name" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.first_name" required="">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div>
                                <label class="label-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.last_name.$invalid }">Last Name</label>
                                <div class="layout-fixed">
                                    <div>
                                        <div class="input-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.last_name.$invalid }" ng-click="focusHandle($event)">
                                            <input type="text" class="h32px" name="last_name" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.last_name" required="">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <label class="label-form-field-1">Company Name</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <input type="text" class="h32px" name="Company Name" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.company_name">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <label class="label-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.email.$invalid }">Email</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : formAddOppotunities.email.$invalid }" ng-click="focusHandle($event)">
                                    <input type="email" class="h32px" name="email" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.email">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <label class="label-form-field-1">Referred By</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <textarea autocomplete="off"
                                              class="ion-autocomplete"
                                              ion-autocomplete=""
                                              item-value-key="id"
                                              item-view-value-key="fullName"
                                              items-clicked-method="clickOnItem(callback,'ref')"
                                              items-method="autoComplete(query,'cus')"
                                              items-method-value-key="items"
                                              items-removed-method="removeItemsAutocomplete(callback,'ref')"
                                              max-selected-items="1"
                                              ng-model="autocompleteList.dataCustomerRefer"
                                              placeholder="" readonly="readonly" style="width:100%" type="text"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm">
                        <label class="label-form-field-1">Address</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-click="focusHandle($event)">
                                    <!-- <ion-google-place getplace="true" location-changed="locationChangedCreate" ng-model="addOpportunitiesData.selectCustomer.street" placeholder="" style="padding: 0px;border-width: 0px;"></ion-google-place> -->
                                    <tags-input ng-model="addOpportunitiesData.selectCustomer.addStreet"
                                    add-on-paste="true"
                                    display-property="description"
                                    key-property="place_id"
                                    on-tag-adding="selectAddress($tag,'addopp')"
                                    enable-editing-last-tag="true"
                                    max-tags="1"
                                    min-tags="1"
                                    on-tag-removed="removetag($tag,'addopp')">
                                    <auto-complete load-on-empty="true" source="loadAddress($query)"></auto-complete>
                                </tags-input>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" ng-model="addOpportunitiesData.selectCustomer.street">
                    </div>
                    <div class="itm">
                        <div class="layout-fixed input-1-group">
                            <div class="layout-w-1:2">
                                <label class="label-form-field-1">City</label>
                                <div class="layout-fixed">
                                    <div>
                                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                                            <input type="text" class="h32px" name="" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.city">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div>
                                <label class="label-form-field-1">State</label>
                                <div class="layout-fixed">
                                    <div>
                                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                                            <input type="text" class="h32px administrative_area_level_1" name="State" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.state">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div>
                                <label class="label-form-field-1">Zip Code</label>
                                <div class="layout-fixed">
                                    <div>
                                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                                            <input type="text" class="h32px postal_code" name="" value="" placeholder="" ng-model="addOpportunitiesData.selectCustomer.zipcode">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ion-scroll>
    </div>
</form>
<div class="app-control">
    <div class="layout-fixed full-h pdT2">
        <div class="w42px full-h relative">
            <button class="bg-transparent pd0-i full text-left pdL10-i" type="button" onclick="openQuickOption(this)">
                <svg class="h20px" viewBox="0 0 460.713 460.713"> <g> <rect y="115.356" width="302" height="30" fill="#FFFFFF" /> <polygon points="335.786,202.231 398.25,264.694 460.713,202.232  " fill="#FFFFFF" /> <rect y="315.356" width="302" height="30" fill="#FFFFFF" /> <rect y="215.356" width="302" height="30" fill="#FFFFFF" /> </g> </svg>
            </button>
            <div class="quick-popup box-popup-1 display-bottom-left mgB55" onclick="closeQuickOption(this)">
                <div class="popup-content w140px">
                    <ul class="list-item-03">
                        <li onclick="getElementById('formAddOppotunities').reset()" ng-click="addOpportunitiesData={}">
                            <div class="layout-fixed">
                                <div class="icon-area">
                                    <svg class="h15px" viewBox="0 0 423.755 423.755"> <path d="M43.84,281.457c-18.585-44.869-18.586-94.29,0-139.159c10.649-25.709,26.678-48.152,46.86-66.135l60.86,60.86V15.099   H29.635l39.88,39.88c-64.293,58.426-88.5,153.2-53.391,237.959c14.167,34.202,37.07,64.159,66.234,86.634   c28.275,21.789,61.873,36.201,97.162,41.677l4.601-29.646C120.778,381.774,68.337,340.597,43.84,281.457z" fill="#FFFFFF" /> <path d="M407.516,292.938c21.652-52.272,21.652-109.848,0-162.12c-14.167-34.202-37.071-64.159-66.234-86.633   C313.007,22.395,279.409,7.983,244.12,2.507l-4.601,29.646c63.342,9.829,115.783,51.005,140.28,110.146   c18.586,44.869,18.586,94.29,0,139.159c-10.649,25.709-26.678,48.152-46.859,66.135l-60.86-60.86v121.924h121.924l-39.801-39.801   C377.118,348.099,395.334,322.348,407.516,292.938z" fill="#FFFFFF" /> </svg>
                                </div>
                                <div class="name-area text-link-1">
                                    Reset all
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="popup-overlay"></div>
            </div>
        </div>
        <div class="full-h">
            <button class="button-form-field-1 darkgray position-left full" type="button" ng-click="closeTarget('#addOpportunity');">
                Cancel
            </button>
        </div>
        <div class="full-h">
            <button class="button-form-field-1 position-right full" onclick="getElementById('submitFormOppotunities').click()" type="button">
                <svg class="icon h14px" viewBox="0 0 28.91 28.91"> <path style="fill:#030104;" d="M4.594,11.533c0,0-3.091,12.141-4.2,16.889l5.937-8.125c-0.539-1.199-0.214-3.018,0.729-4.049   c1.266-1.383,3.52-1.383,4.904-0.117s1.479,3.414,0.213,4.797c-0.959,1.053-2.733,1.477-3.989,1.008L0.771,28.91l15.646-6.059   l6.287-9.42l-8.229-7.705L4.594,11.533z" /> <polygon style="fill:#030104;" points="20.669,0 16.153,4.193 24.241,11.988 28.515,7.555  " /> </svg>
                Add
            </button>
        </div>
    </div>
</div>
