<div class="stag-popup stag-popup-md mcp-theme-1" stag-popup-key="new-prescription-popup-LAB">
    <form method="POST" action="" class="overflow-visible">
        <h3 class="stag-popup-title mb-2">
            <span>Lab Prescription</span>
            <a href="#" class="ml-auto text-secondary"
               onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
        </h3>

        <div class="d-flex align-items-baseline mt-3">
            <span class="font-weight-bold mr-3">Test Sets</span>
            <a href="#" v-on:click.prevent="addTestSet(true)">Add Test Set</a>
        </div>

        <div v-for="(item, itemIndex) in newPrescription_LAB.clinicalDetailJson.items" class="border bg-light px-2 pt-2 pb-1 my-2">
            <div class="row">
                <div class="col-6 pr-2">
                    <div class="d-flex align-items-baseline mb-1">
                        <span class="text-secondary mr-3">Tests</span>
                        <a href="#" v-on:click.prevent="addTest(item)">Add Test</a>
                    </div>
                    <div v-for="(test, testIndex) in item.tests" class="d-flex align-items-baseline mb-1">
                        <div class="position-relative flex-grow-1">
                            <input type="text" class="min-width-unset form-control form-control-sm" data-option-list v-model="test.desc">
                            <div class="data-option-list">
                                <div>Complete Blood Count</div>
                                <div>Prothrombin Time</div>
                                <div>Basic Metabolic Panel</div>
                                <div>Comprehensive Metabolic Panel</div>
                                <div>Lipid Panel</div>
                                <div>Liver Panel</div>
                                <div>Thyroid Stimulating Hormone</div>
                                <div>Hemoglobin A1C</div>
                                <div>Urinalysis</div>
                            </div>
                        </div>
                        <a href="#" v-if="item.tests && item.tests.length > 1" v-on:click.prevent="deleteTest(item, testIndex)" class="pl-2">
                            <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
                        </a>
                        <span v-if="item.tests && item.tests.length === 1" class="pl-2">
                            <i class="fa fa-trash-alt text-secondary on-hover-opaque"></i>
                        </span>
                    </div>
                </div>
                <div class="col-6 pl-2 border-left">
                    <div class="d-flex align-items-baseline mb-1">
                        <span class="text-secondary mr-3">ICDs</span>
                        <a href="#" v-on:click.prevent="addICD(item)">Add ICD</a>
                    </div>
                    <div v-for="(icd, icdIndex) in item.icds" class="d-flex align-items-baseline mb-1">
                        <input type="text" class="min-width-unset form-control form-control-sm width-100px mr-2"
                               data-field="icd" :data-item-index="itemIndex" :data-icd-index="icdIndex" data-category="LAB"
                               v-model="icd.code">
                        <input type="text" class="min-width-unset form-control form-control-sm flex-grow-1" v-model="icd.desc">
                        <a href="#" v-if="item.icds && item.icds.length > 1" v-on:click.prevent="deleteICD(item, icdIndex)" class="pl-2">
                            <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
                        </a>
                        <span v-if="item.icds && item.icds.length === 1" class="pl-2">
                            <i class="fa fa-trash-alt text-secondary on-hover-opaque"></i>
                        </span>
                    </div>
                </div>
            </div>
        </div>

        <div class="font-weight-bold mt-3 mb-1">
            <!--<span v-if="currentPrescription && currentPrescription.erx_category === 'DRUG'">Pharmacy</span>
            <span v-else-if="currentPrescription && currentPrescription.erx_category === 'LAB'">Lab</span>
            <span v-else-if="currentPrescription && currentPrescription.erx_category === 'IMAGING'">Lab</span>
            <span v-else>Logistics</span>-->
            <span>Logistics</span>
        </div>
        <div class="mb-2">
            <label class="text-sm text-secondary mb-1">Business Name</label>
            <input type="text" class="form-control form-control-sm min-width-unset facility-search"
                   stag-suggest
                   stag-suggest-ep="/search-facility/json"
                   autocomplete="donotdoit"
                   v-model="newPrescriptionLogistics.logisticsDetailJson.facilityName">
        </div>
        <div class="row">
            <div class="col-4 pr-0">
                <div class="mb-2">
                    <label class="text-sm text-secondary mb-1">City</label>
                    <input type="text" class="form-control form-control-sm min-width-unset"
                           v-model="newPrescriptionLogistics.logisticsDetailJson.facilityCity">
                </div>
            </div>
            <div class="col-4 pr-0">
                <div class="mb-2">
                    <label class="text-sm text-secondary mb-1">State</label>
                    <input type="text" class="form-control form-control-sm min-width-unset"
                           v-model="newPrescriptionLogistics.logisticsDetailJson.facilityState">
                </div>
            </div>
            <div class="col-4">
                <div class="mb-2">
                    <label class="text-sm text-secondary mb-1">ZIP</label>
                    <input type="text" class="form-control form-control-sm min-width-unset"
                           v-model="newPrescriptionLogistics.logisticsDetailJson.facilityZip">
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-6 pr-0">
                <div class="mb-2">
                    <label class="text-sm text-secondary mb-1">Phone</label>
                    <input type="text" class="form-control form-control-sm min-width-unset"
                           v-model="newPrescriptionLogistics.logisticsDetailJson.facilityPhone">
                </div>
            </div>
            <div class="col-6">
                <div class="mb-2">
                    <label class="text-sm text-secondary mb-1">Fax</label>
                    <input type="text" class="form-control form-control-sm min-width-unset"
                           v-model="newPrescriptionLogistics.logisticsDetailJson.facilityFax">
                </div>
            </div>
        </div>

        <div class="d-flex align-items-center justify-content-center mt-3">
            <button type="button" class="btn btn-sm btn-primary mr-2" v-on:click.prevent="saveNewPrescription()">Submit
            </button>
            <button type="button" class="btn btn-sm btn-default border" onclick="return closeStagPopup()">Cancel
            </button>
        </div>
    </form>
</div>
