<div class="modal-header">
	<a class="close" ng-click="$dismiss()" aria-label="close">&times;</a>
	<h3 class="modal-title"> <span>{{vm.title}}</span></h3>
</div>
<div class="modal-body form-group">
	<form name="myForm">
		<div class="input-group">
			<label class="input-group-addon">Format:</label>
			<select id="export-format" class="form-control" ng-model="vm.format" uib-tooltip="{{vm.quickGuide()}}" tooltip-placement="top">
				<option id="export-format-bin">BIN</option>
				<option id="export-format-coff">COFF</option>
			</select>
			<label class="input-group-addon" ng-if="vm.pageInfoList.length > 1">Page:</label>
			<select class="form-control" ng-model="vm.curPage" ng-if="vm.pageInfoList.length > 1" uib-tooltip="Memory Page to read." tooltip-placement="top" tooltip-trigger="mouseenter"
				tooltip-popup-delay="300">
					<option ng-repeat="pageInfo in vm.pageInfoList">{{pageInfo.name}}</option>
			</select>
		</div>

		<div class="input-group" ng-show="!vm.showTable()">
			<label class="input-group-addon">Address:</label>
			<input id="export-address" type="text" class="form-control" ng-model="vm.addrInput" placeholder="0x00000000" ng-pattern="vm.validateAddressRegex" >
			<label class="input-group-addon">Number of bytes({{vm.mauSizeInBits}} bits per byte):</label>
			<input id="export-length" type="text" class="form-control" ng-model="vm.bytesCountInput" placeholder="hex or decimal value" uib-tooltip="Final output will be word size aligned. ie. 32-bits aligned for the all devices except for C28 which is always aligned." tooltip-placement="bottom" tooltip-trigger="mouseenter"
			tooltip-popup-delay="500">
		</div>
		<div style="margin-top:20px;" ng-show="vm.showTable()">
			<table class="table table-hover">
				<tr>
					<td><label>Address</label></td>
					<td><label>Length in bytes({{vm.mauSizeInBits}} bits per byte)</label></td>
					<td>
						<!-- <i class="glyphicon glyphicon-remove clickable" style="vertical-align:middle;" ng-click="vm.exportConfig.ranges=[]"></i> --></td>
				</tr>
				<tr ng-repeat="range in vm.exportConfig.ranges">
					<td>0x{{range.address.toString(16)}}</td>
					<td>{{range.length}}</td>
					<td><i class="glyphicon glyphicon-remove clickable" style="vertical-align:middle;" ng-click="vm.removeRange(range)" uib-tooltip="Remove"
							tooltip-placement="top"></i></td>
				</tr>
				<tr>
					<td><input id="export-range-address" type="text" class="form-control" ng-model="vm.addrInput" placeholder="0x00000000" ng-pattern="vm.validateAddressRegex"></td>
					<td><input id="export-range-length" type="text" class="form-control" ng-model="vm.bytesCountInput" placeholder="hex or decimal value"></td>
					<td><i id="export-range-add" class="glyphicon glyphicon-plus clickable" style="vertical-align:middle;" ng-click="vm.addRange(vm.addrInput, vm.bytesCountInput)"
							uib-tooltip="Add memory range" tooltip-placement="bottom"></i></td>
				</tr>
			</table>
		</div>

		<div class="form-group" style="margin-top:20px;">
			<label class="control-label">File:</label>
			<div class="input-group">
				<input id="export-path" type="text" class="form-control" ng-model="vm.path" placeholder="export_memory{{vm.getExtension()}}" ng-pattern="vm.validFileName">
				<span ng-hide="!vm.isNW()" class="input-group-btn">
					<button type="button" style="display:table-cell;margin-left:8px;margin-right:20px;" class="btn btn-success btn-sm" id="browse-export" ng-click="vm.browseExportFile();">
						<span class="glyphicon glyphicon-hdd"></span> Browse
					</button>
				</span>
			</div>
		</div>
	</form>
	<div style="margin-top:10px;">
		<div style="color:red;">{{vm.msg}}</div>
	</div>
</div>
<div class="modal-footer">
	<span uib-tooltip="Add memory ranges using the + button to continue." tooltip-trigger="mouseenter" tooltip-enable="!vm.readyToExport()&&vm.format=='COFF'" tooltip-placement="top" tooltip-popup-delay="300">
	<button id="export-generate" type="button" class="btn btn-primary" ng-disabled="!vm.readyToExport()" ng-click="vm.exportToLocal()" >
	Generate
	</button>
	</span>
	<button class="btn btn-default" type="button" ng-click="$dismiss('Cancel Clicked')">Cancel</button>
</div>