<style>
	select, input[type="file"]{
	height: auto !important;
	}
</style>

<script type="text/javascript">
	function isValid(str) {
	    var iChars = "~`!#$%^&*+=-[]\\\';,/{}|\":<>?";
	
	    for (var i = 0; i < str.length; i++) {
	       if (iChars.indexOf(str.charAt(i)) != -1) {
	           alert ("File name has special characters ~`!#$%^&*+=-[]\\\';,/{}|\":<>? \nThese are not allowed\n");
	           return false;
	       }
	    }
	    return true;
	}

	 function validate(file) {
	 	    var ext = file.split(".");
	 	    ext = ext[ext.length-1].toLowerCase();      
	 	    var arrayExtensions = ["csv"];

	 	    if (arrayExtensions.lastIndexOf(ext) == -1) {
	 	        alert("Wrong extension type. Only below file types that can be uploaded: .csv");
	 	        $("#CourseXlsFile").val("");
	 	    }
	 	}
</script>
<div class="blocktitle">Upload-Course</div>
<?php echo $this->element('networkcourselistmenu');?>
<div class="w97p">
	<div class="icspan12"  style="margin-top: 20px; padding:0;">
		<?php echo $this->Form->create('Course',array('type' => 'file','class'=>'form-horizontal','role'=>'form','url'=>array('controller'=>'courses','action'=>'xlsfile',$this->params['pass'][0]),'onsubmit'=>'return isValid( this )')); ?>
			<fieldset>
				<h3>Upload Course</h3>
				<div class="form-group">
					<div class="col-sm-3">
						<?php echo $this->Form->input('country',array('empty'=>'Select Country','type'=>'select','label'=>false,'class'=>'form-control col-sm-12'));?>
					</div>
				</div>
				<div class="form-group">
				
					<div class="col-sm-3">
						<?php echo $this->Form->file('xls_file', array('type'=>'file','label'=>false,'class' => '','onchange'=>"validate(this.value)"));
						?>
						
						<?php foreach ($pricings as $pricing){
		               		//pr($pricing);
		               		$price=10+(2*2);
		               	?>
			              
		               		<?php echo $this->Form->input('Transaction.totalUsd',array('type'=>'hidden','value'=>$price));?>
		               	<?php }?>
						<div class="btn-group" style="margin-top: 10px;">
							<button type="submit" class="btn">Submit</button>
						</div>
					</div>
				</div>
			
			</fieldset>
		<?php echo $this->Form->end(); ?>
	</div>
</div>

