<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">{{estimate_no}}</div>
                <div class="text-title-header-1 nowrap mgT10">Send to</div>
            </div>
        </div>
    </div>
    <button class="popup-back-button bg-transparent pd0-i biger-3-time" type="button" ng-click="closeTarget('#popupOrderEstimateSendToDetail')"></button>
</div>
<form class="app-content" name="frmEstimateSendmail" id="frmEstimateSendmail" ng-submit="AdvancedEmailCustomer('Send_To', sendMailType.value, email_sento.value, Snail_Mail.value, frmEstimateSendmail)" novalidate="">
    <div class="app-content-inner content-pd">
        <button id="submitFrmEstimateSendmail" style="display:none;" type="submit">Submit</button>
        <ion-scroll class="scroll-area" direction="y" has-bouncing="false" overflow-scroll="false" delegate-handle="scrollOrderEstimateSendToDetail" on-scroll="scrollContent('scrollOrderEstimateSendToDetail')">
            <div class="box-setting-4 form-field-container">
                <div class="content content-in">
                    <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1 normal">Email</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" name="invoice_check" ng-model="sendMailType.value" value="email" /><i></i><span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm pdT0-i" ng-if="sendMailType.value == 'email'">
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.email.$invalid  }">
                                    <input type="email" class="h32px" name="email" id="email" placeholder="" required ng-model="email_sento.value">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1 normal">Snail mail</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" name="invoice_check" ng-model="sendMailType.value" value="Snail_Mail" /><i></i><span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm pdT0-i" ng-if="sendMailType.value == 'Snail_Mail'">
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.snail_mail.$invalid  }">
                                    <input type="email" class="h32px" name="snail_mail" id="snail_mail" value="" placeholder="" required ng-model="Snail_Mail.value">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1 normal">Advance Email</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" name="invoice_check" ng-model="sendMailType.value" value="advance" ng-click="getcustomermail()" /><i></i><span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm"  ng-class="{ 'pdT0-i' : $index == 0 }" ng-if="sendMailType.value == 'advance'" ng-repeat="item in AdvancedEmail.emails track by $index">
                        <label class="label-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.indexemail{{$index}}.$invalid  }">Email #{{$index + 1}}</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.indexemail{{$index}}.$invalid  }">
                                    <input type="text" class="h32px" id="indexemail-{{$index}}" ng-model="item.text" placeholder="Example@email.com" name="indexemail{{$index}}" required>
                                    <div class="sign-r clear">
                                        <button class="bg-transparent full-h right pdR8" type="button" ng-click="addEstEmail()" ng-if="$index==0">
                                            <svg class="h20px" viewBox="0 0 53 53"> <polygon style="fill:#B1C7D7;" points="7,8.5 47,8.5 47,0.5 0,0.5 0,45.5 7,45.5 " /> <rect x="7" y="8.5" style="fill:#1075BB;" width="46" height="44" /> <line style="fill:none;stroke:#FFF;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="30" y1="19.5" x2="30" y2="41.5" /> <line style="fill:none;stroke:#FFF;stroke-width:3;stroke-linecap:round;stroke-miterlimit:10;" x1="41" y1="30.5" x2="19" y2="30.5" /> </svg>
                                        </button>
                                    </div>
                                    <div class="sign-r text-right">
                                        <button class="bg-transparent h39px pdR5 pdB3" ng-click="removeEstEmail($index)" type="button" ng-if="$index!=0">
                                            <svg class="h16px" viewBox="0 0 64 64"> <g> <path fill="#D75A4A" d="M28.941,31.786L0.613,60.114c-0.787,0.787-0.787,2.062,0,2.849c0.393,0.394,0.909,0.59,1.424,0.59   c0.516,0,1.031-0.196,1.424-0.59l28.541-28.541l28.541,28.541c0.394,0.394,0.909,0.59,1.424,0.59c0.515,0,1.031-0.196,1.424-0.59   c0.787-0.787,0.787-2.062,0-2.849L35.064,31.786L63.41,3.438c0.787-0.787,0.787-2.062,0-2.849c-0.787-0.786-2.062-0.786-2.848,0   L32.003,29.15L3.441,0.59c-0.787-0.786-2.061-0.786-2.848,0c-0.787,0.787-0.787,2.062,0,2.849L28.941,31.786z" /> </g> </svg>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm" ng-if="sendMailType.value == 'advance'">
                        <label class="label-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.contents.$invalid  }">Customized Message</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{ 'has-errors' : frmEstimateSendmail.contents.$invalid  }">
                                    <textarea ng-model="AdvancedEmail.Message" maxlength="500" required name="contents" placeholder="" class="h100px"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="itm" ng-if="sendMailType.value == 'advance'">
                        <label class="label-form-field-1" ng-class="{'has-errors' : AdvancedEmail.SendFrom.length == 0 }">Send From</label>
                        <div class="layout-fixed">
                            <div>
                                <div class="input-form-field-1" ng-class="{'has-errors' : AdvancedEmail.SendFrom.length == 0 }">
                                    <input autocomplete="off"
                                           class="ion-autocomplete-est-sent-from h32px"
                                           ion-autocomplete=""
                                           item-value-key="id"
                                           item-view-value-key="screen_name"
                                           items-clicked-method="onSelectAutocomplete(callback,'sendFrom')"
                                           items-removed-method="onRemoveAutocomplete(callback,'sendFrom')"
                                           items-method="filterAutocomplete(query,true,'sendFrom')"
                                           items-method-value-key="items"
                                           max-selected-items="1"
                                           ng-model="estimeAutocompleteList.sendform"
                                           placeholder=""
                                           readonly="readonly"
                                           style="width:100%"
                                           external-model="initialEstimateSendFrom"
                                           model-to-item-method="modelAutocomplete(modelValue,'sendFrom')" />
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1 normal">Generate printable PDF</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" name="invoice_check" ng-model="sendMailType.value" value="Generate_printable_PDF" /><i></i><span></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="itm">
                        <div class="layout-fixed">
                            <div class="pdB5">
                                <label class="label-form-field-1 normal">B/W low DPI PDF</label>
                            </div>
                            <div class="w60px clear">
                                <div class="checkedbox-toggle-1 block-i right">
                                    <input type="radio" name="invoice_check" ng-model="sendMailType.value" value="Generate_printable_PDF_DPI" /><i></i><span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ion-scroll>
    </div>
</form>
<div class="app-control">
    <div class="layout-fixed full-h pdT2">
        <div class="full-h">
            <button class="button-form-field-1 darkgray position-left full" type="button" ng-click="closeTarget('#popupOrderEstimateSendToDetail');">
                Cancel
            </button>
        </div>
        <div class="full-h">
            <button class="button-form-field-1 position-right full" onclick="getElementById('submitFrmEstimateSendmail').click()">
                <svg class="icon h20px" viewBox="0 0 191.614 191.614"> <polygon points="191.614,45.206 81.708,45.206 136.659,80.929   " /> <polygon points="81.708,50.705 81.708,93.137 139.064,93.137 139.064,116.65 191.614,116.65 191.614,50.705 136.659,86.427   " /> <polygon points="60.462,102.992 60.462,146.408 132.829,146.408 132.829,102.992 96.647,126.509   " /> <polygon points="96.647,122.886 132.829,99.376 60.462,99.376   " /> <rect height="3.117" width="48.655" y="118.733" /> <rect height="3.118" width="47.992" y="91.429" x="6.235" /> <rect height="3.118" width="72.933" y="64.125" /> </svg>
                Send
            </button>
        </div>
    </div>
</div>
