<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-name-header-1 nowrap">Opportunity</div>
        <div class="text-title-header-1 nowrap mgT10">Filter & report</div>
      </div>
    </div>
  </div>
  <button class="popup-close-button bg-transparent pd0-i biger-3-time" type="button" ng-click="closeTarget('#popupOpportunityFilterReport')"></button>
</div>
<form class="app-content" ng-show="!requiredFlag" id="frmpopupAddopportunitiesFollowUp" novalidate="">
  <div class="app-content-inner content-pd">
    <button type="submit" id="submitFormFilterOpp" style="display:none;"></button>
    <ion-scroll class="scroll-area" direction="y" has-bouncing="false" overflow-scroll="false" delegate-handle="scrollFilter" on-scroll="scrollContent('scrollFilter')">
      <div class="box-setting-4 form-field-container">
        <div class="content content-in">
          <div class="itm">
            <div class="layout-fixed input-1-group">
              <div>
                <label class="label-form-field-1">From</label>
                <div class="layout-fixed">
                  <div>
                    <div class="input-form-field-1" ng-click="focusHandle($event)">
                      <input type="text" class="h32px" id="filter_from_date" value="{{filter_from_date | date: 'MM/dd/yyyy'}}" />
                      <div class="field-overlay datetime" date="" ion-datetime-picker="" name="filter_from_date" ng-model="filter_from_date" only-valid="{'between': {'initial':'1980-01-01', 'final': filter_to_date}, 'inclusive': true}">
                        {{filter_from_date| date: 'MM/dd/yyyy'}}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div>
                <label class="label-form-field-1">To</label>
                <div class="layout-fixed">
                  <div>
                    <div class="input-form-field-1" ng-click="focusHandle($event)">
                      <input type="text" class="h32px" id="filter_to_date" value="{{filter_to_date| date: 'MM/dd/yyyy'}}" />
                      <div class="field-overlay datetime" date="" ion-datetime-picker="" name="filter_to_date" ng-model="filter_to_date" only-valid="{'after': filter_from_date}">
                        {{filter_to_date| date: 'MM/dd/yyyy'}}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
                    <!-- <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1">Search by Start date</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" id="" name="rdSearchBy" value="" checked>
                                    <input type="checkbox" placeholder="" id="searchByCreateDay" ng-model="dataFilterOppotunities.searchByCreateDay"/>
                                    <i></i><span></span>
                                </div>
                            </div>
                        </div>
                      </div> -->
                      <div class="itm">
                        <div class="layout-fixed">
                          <div class="pdB5">
                            <label class="label-form-field-1">Search by Created date</label>
                          </div>
                          <div class="w60px clear">
                            <div class="checkedbox-toggle-1 block-i right">
                              <input type="checkbox" placeholder="" id="searchByCreateDay" ng-model="dataFilterOppotunities.searchByCreateDay" /><i></i><span></span>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="itm">
                        <label class="label-form-field-1">Saved query</label>
                        <div class="layout-fixed">
                          <div>
                            <div class="input-form-field-1" ng-click="focusHandle($event)">
                              <input type="text" class="h32px" name="" value="{{inputValue.query}}" placeholder="">
                              <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="lead-source-add-customer field-overlay" ng-model="queryId" ng-change="fillFilterData(queryId)">
                                <option value="new" ng-selected="queryId=='new'">New queries</option>
                                <option ng-repeat="item in dataOppQuery" value="{{item.id}}" ng-selected="item.id==queryId">{{item.name}}</option>
                              </select>
                            </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">Client name</label>
                        <div class="layout-fixed">
                          <div>
                            <div class="input-form-field-1" ng-click="focusHandle($event)">
                              <textarea autocomplete="off"
                              class="ion-autocomplete-search-opp-filter"
                              ion-autocomplete=""
                              item-value-key="id"
                              item-view-value-key="name"
                              items-clicked-method="clickOnItem(callback,'oppfiltercus')"
                              items-method="autoComplete(query,'cus')"
                              items-method-value-key="items"
                              items-removed-method="removeItemsAutocomplete(callback,'oppfiltercus')"
                              max-selected-items="1"
                              ng-model="autocompleteList.oppfiltercus"
                              external-model="initialSearchCustomerOppFilter"
                              model-to-item-method="setValueForInputSearchCustomerOppFilter(modelValue)"
                              placeholder="Please input client phone, client name or client addess to search" 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="addressPress" ng-model="dataFilterOppotunities.addrress" placeholder="" style="padding: 0px;border-width: 0px;" name="street"></ion-google-place> -->
                              <tags-input ng-model="arrAddress"
                              add-on-paste="true"
                              display-property="description"
                              key-property="place_id"
                              on-tag-adding="selectAddress($tag,'filteropp')"
                              enable-editing-last-tag="true"
                              max-tags="1"
                              min-tags="1"
                              on-tag-removed="removetag($tag,'filteropp')">
                              <auto-complete load-on-empty="true" source="loadAddress($query)"></auto-complete>
                            </tags-input>
                          </div>
                        </div>
                      </div>
                      <input type="hidden" ng-model="dataFilterOppotunities.addrress">
                    </div>
                    <div class="itm">
                      <label class="label-form-field-1">City</label>
                      <div class="layout-fixed">
                        <div>
                          <div class="input-form-field-1" ng-click="focusHandle($event)">
                            <textarea autocomplete="off"
                            class="ion-autocomplete-search-opp-filter-city"
                            ion-autocomplete=""
                            item-value-key="city"
                            item-view-value-key="city"
                            items-clicked-method="clickOnItem(callback,'oppfiltercity')"
                            items-method="autoComplete(query,'oppfiltercity')"
                            items-method-value-key="items"
                            items-removed-method="removeItemsAutocomplete(callback,'oppfiltercity')"
                            max-selected-items="50"
                            ng-model="autocompleteList.oppfiltercity"
                            external-model="initialSearchCustomerOppFilterCity"
                            model-to-item-method="setValueForInputSearchCustomerOppFilterCity(modelValue)"
                            placeholder="" readonly="readonly" style="width:100%;"
                            type="text"></textarea>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="itm">
                      <label class="label-form-field-1">Zip code</label>
                      <div class="layout-fixed">
                        <div>
                          <div class="input-form-field-1" ng-click="focusHandle($event)">
                            <textarea autocomplete="off"
                            class="ion-autocomplete-search-opp-filter-zip"
                            ion-autocomplete=""
                            item-value-key="postal_code"
                            item-view-value-key="postal_code"
                            items-clicked-method="clickOnItem(callback,'oppfilterzip')"
                            items-method="autoComplete(query,'oppfilterzip')"
                            items-method-value-key="items"
                            items-removed-method="removeItemsAutocomplete(callback,'oppfilterzip')"
                            max-selected-items="50"
                            ng-model="autocompleteList.oppfilterzip"
                            external-model="initialSearchCustomerOppFilterZip"
                            model-to-item-method="setValueForInputSearchCustomerOppFilterZip(modelValue)"
                            placeholder="" readonly="readonly" style="width:100%;"
                            type="text"></textarea>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="itm">
                      <label class="label-form-field-1">Phone</label>
                      <div class="layout-fixed">
                        <div>
                          <div class="input-form-field-1" ng-click="focusHandle($event)">
                            <textarea autocomplete="off"
                            class="ion-autocomplete-search-opp-filter-phone"
                            ion-autocomplete=""
                            item-value-key="phone"
                            item-view-value-key="phone"
                            items-clicked-method="clickOnItem(callback,'oppfilterphone')"
                            items-method="autoComplete(query,'oppfilterphone')"
                            items-method-value-key="items"
                            items-removed-method="removeItemsAutocomplete(callback,'oppfilterphone')"
                            max-selected-items="1"
                            ng-model="autocompleteList.oppfilterphone"
                            external-model="initialSearchCustomerOppFilterPhone"
                            model-to-item-method="setValueForInputSearchCustomerOppFilterPhone(modelValue)"
                            placeholder="" readonly="readonly" style="width:100%;"
                            type="text"></textarea>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="itm">
                      <label class="label-form-field-1">Lead source</label>
                      <div class="layout-fixed">
                        <div>
                          <div class="input-form-field-1" ng-click="focusHandle($event)">
                            <textarea autocomplete="off"
                            class="ion-autocomplete-search-opp-filter-leadsource"
                            ion-autocomplete=""
                            item-value-key="key"
                            item-view-value-key="key"
                            items-clicked-method="clickOnItem(callback,'oppfilterleadsource')"
                            items-method="autoComplete(query,'oppfilterleadsource')"
                            items-method-value-key="items"
                            items-removed-method="removeItemsAutocomplete(callback,'oppfilterleadsource')"
                            max-selected-items="50"
                            ng-model="autocompleteList.oppfilterleadsource"
                            external-model="initialSearchCustomerOppFilterLeadsource"
                            model-to-item-method="setValueForInputSearchCustomerOppFilterLeadsource(modelValue)"
                            placeholder="" readonly="readonly" style="width:100%;"
                            type="text"></textarea>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="itm row-one-content">
                      <div class="layout-fixed">
                        <div class="pdB5">
                          <label class="label-form-field-1">Manual Input Lead source</label>
                        </div>
                        <div class="w60px clear">
                          <div class="checkedbox-toggle-1 block-i right">
                            <input type="checkbox" name="" ng-model="dataFilterOppotunities.checkManualLeadSoure" ng-change="manualLeadSoureClick(dataFilterOppotunities.checkManualLeadSoure)" /><i></i><span></span>
                          </div>
                        </div>
                      </div>
                      <div class="layout-fixed mgT8">
                        <div>
                          <div class="input-form-field-1" ng-if="viewInpuntManualLead" ng-click="focusHandle($event)">
                            <tag-input ui-tag-input-id="criteria1"
                            add-on-enter="true"
                            add-on-blur="true"
                            add-on-space="false"
                            ng-model="dataFilterOppotunities.manualLeadSoure"
                            placeholder=""
                            load-on-empty="true"
                            min-tags="1"
                            allowed-tags-pattern="^[#a-zA-Z0-9._+-@ ]+[\;\\\/]{0}$"
                            replace-spaces-with-dashes="false">
                          </tag-input>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="itm">
                    <label class="label-form-field-1">Representative</label>
                    <div class="layout-fixed">
                      <div>
                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                          <textarea autocomplete="off"
                          class="ion-autocomplete-search-opp-filter-rep"
                          ion-autocomplete=""
                          item-value-key="id"
                          item-view-value-key="name"
                          items-clicked-method="clickOnItem(callback,'oppfilterrep')"
                          items-method="autoComplete(query,'oppfilterrep')"
                          items-method-value-key="items"
                          items-removed-method="removeItemsAutocomplete(callback,'oppfilterrep')"
                          max-selected-items="50"
                          ng-model="autocompleteList.oppfilterrep"
                          external-model="initialSearchCustomerOppFilterRep"
                          model-to-item-method="setValueForInputSearchCustomerOppFilterRep(modelValue)"
                          placeholder="" readonly="readonly" style="width:100%;"
                          type="text"></textarea>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="itm">
                    <label class="label-form-field-1">Assignee</label>
                    <div class="layout-fixed">
                      <div>
                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                          <textarea autocomplete="off"
                          class="ion-autocomplete-search-opp-filter-assignee"
                          ion-autocomplete=""
                          item-value-key="id"
                          item-view-value-key="name"
                          items-clicked-method="clickOnItem(callback,'oppfilterassignee')"
                          items-method="autoComplete(query,'oppfilterassignee')"
                          items-method-value-key="items"
                          items-removed-method="removeItemsAutocomplete(callback,'oppfilterassignee')"
                          max-selected-items="50"
                          ng-model="autocompleteList.oppfilterassignee"
                          external-model="initialSearchCustomerOppFilterAssignee"
                          model-to-item-method="setValueForInputSearchCustomerOppFilterAssignee(modelValue)"
                          placeholder="" readonly="readonly" style="width:100%;"
                          type="text"></textarea>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="itm">
                    <label class="label-form-field-1">Status</label>
                    <div class="layout-fixed">
                      <div>
                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                          <input type="text" class="h32px" name="" value="{{inputValue.filterStatus}}" placeholder="">
                          <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="dataFilterOppotunities.status" ng-change="setValueForSubStatus(dataFilterOppotunities.status)">
                            <option value="All" selected>All</option>
                            <option ng-repeat="item in opportunitytabs" ng-if="item.parent_id == null" value="{{item.id}}"> {{item.name}} </option>
                          </select>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="itm" ng-show="dataFilterOppotunities.status != '1' && dataFilterOppotunities.status != '10' ">
                    <label class="label-form-field-1">Sub status</label>
                    <div class="layout-fixed">
                      <div>
                        <div class="input-form-field-1" ng-click="focusHandle($event)">
                          <input type="text" class="h32px" name="" value="{{inputValue.filterSubStatus}}" placeholder="">
                          <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="dataFilterOppotunities.subStatus" ng-change="setInputValueForSubStatus(dataFilterOppotunities.subStatus)">
                            <option value="All" selected>All</option>
                            <option ng-repeat="item in opportunitytabs" ng-if="item.parent_id == dataFilterOppotunities.status" value="{{item.id}}"> {{item.name}} </option>
                          </select>
                        </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 ng-click="fillFilterData('new')">
                      <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">
                          Clear all
                        </div>
                      </div>
                    </li>
                  </ul>
                </div>
                <div class="popup-overlay"></div>
              </div>
            </div>
            <div class="full-h" ng-if="inputValue.query != 'New Queries' && roleName==isAdmin">
              <button class="button-form-field-1 red position-left full" type="button" ng-click="filterOppotunities('Delete')">
                Delete
              </button>
            </div>
            <div class="full-h" ng-if="inputValue.query == 'New Queries'">
              <button type="button" class="button-form-field-1 position-right full" ng-click="beforeSaveQuery()">
                <!--<svg class="icon h12px" viewBox="0 0 267.745 267.745"> <path d="M218.266,0v67.921c0,10.77-8.82,19.59-19.6,19.59H68.057c-10.77,0-19.579-8.82-19.579-19.59V0.02   h-16.71l0,0c-13.154,0-23.893,11.417-23.893,25.378v219.263c0,12.699,9.769,23.084,21.721,23.084H238.15   c11.951,0,21.721-10.385,21.721-23.075V50.969L218.266,0z M221.54,231.295c0,9.406-7.688,17.084-17.084,17.084H66.219   c-9.396,0-17.074-7.678-17.074-17.084v-71.194c0-9.406,7.678-17.085,17.074-17.085h138.237c9.396,0,17.084,7.679,17.084,17.085   V231.295z" style="fill:#030104;" /> <path d="M202.989,171.516H67.665c-0.799,0-1.447,0.648-1.447,1.447v3.521c0,0.799,0.648,1.447,1.447,1.447   h135.324c0.799,0,1.446-0.648,1.446-1.447v-3.521C204.435,172.164,203.788,171.516,202.989,171.516z" style="fill:#030104;" /> <path d="M202.989,184.348H67.665c-0.799,0-1.447,0.646-1.447,1.446v3.521c0,0.8,0.648,1.446,1.447,1.446   h135.324c0.799,0,1.446-0.646,1.446-1.446v-3.521C204.435,184.994,203.788,184.348,202.989,184.348z" style="fill:#030104;" /> <path d="M202.989,197.178H67.665c-0.799,0-1.447,0.648-1.447,1.447v3.521c0,0.799,0.648,1.447,1.447,1.447   h135.324c0.799,0,1.446-0.648,1.446-1.447v-3.521C204.435,197.826,203.788,197.178,202.989,197.178z" style="fill:#030104;" /> <path d="M179.708,70.294h20.322c1.979,0,3.598-1.616,3.598-3.594V0.031h-27.492v66.692   C176.136,68.689,177.746,70.294,179.708,70.294z" style="fill:#030104;" /> </svg>-->
                Save
              </button>
            </div>
            <div class="layout-w-1:7">
              <button type="button" class="button-form-field-1 full blue-gray" ng-click="filterOppotunities('Export')">
                <svg class="h15px clr-white" viewBox="0 0 478.125 478.125"> <polygon points="229.5,47.812 229.5,258.188 248.625,258.188 248.625,47.812 309.825,109.013 325.125,95.625 239.062,9.562     153,95.625 168.3,109.013   " /> <path d="M382.5,143.438H267.75v19.125h103.275l84.149,133.875h-130.05v38.25c0,21.037-17.213,38.25-38.25,38.25H191.25    c-21.038,0-38.25-17.213-38.25-38.25v-38.25H22.95l84.15-133.875h103.275v-19.125H95.625L0,296.438v172.125h478.125v-153v-19.125    L382.5,143.438z" /> </svg>
              </button>
            </div>
            <div class="full-h">
              <button class="button-form-field-1 position-right full" type="button" ng-click="closeTarget('#popupOpportunityFilterReport') ; filterOppotunities('Display')">
                <svg class="icon h12px" viewBox="0 0 288.136 288.136"> <path d="M253.094,35.437c-22.634-22.634-52.727-35.099-84.735-35.099s-62.102,12.465-84.735,35.099  c-38.632,38.632-45.319,97.294-20.067,142.865L9.496,232.364c-12.661,12.661-12.661,33.262,0,45.923  c6.133,6.134,14.287,9.511,22.961,9.511s16.828-3.377,22.961-9.511l53.821-53.821c17.824,10.141,38.057,15.539,59.12,15.539  c32.009,0,62.102-12.464,84.735-35.098C299.817,158.183,299.817,82.16,253.094,35.437z M231.882,183.694  c-16.968,16.967-39.527,26.311-63.522,26.311s-46.555-9.344-63.522-26.311c-35.025-35.026-35.025-92.019,0-127.044  c16.968-16.968,39.527-26.312,63.522-26.312s46.555,9.344,63.522,26.312C266.907,91.676,266.907,148.668,231.882,183.694z" /> </svg>
                Display
              </button>
            </div>
          </div>
        </div>
