<?php echo $header;?>
<div id="dashboard">
	<div class="container">
<div class="row"><br/></div>
<div class="panel">

	<div class="panel-header">
		<?php echo $LANG["WBS_ADVERTISER_BANNER_NEW"];?>
	</div>

<div class="panel-content">
<div class="row"><br/></div>
<div class="col-md-12">


<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_AD_TYPE"];?></label>
	<select id="adv-ad-type" class="form-control">
		<option value="<?php echo HTTP_SERVER_WEBSITE;?>dashboard/advertiser/ad"><?php echo $LANG["WBS_ADVERTISER_BANNER_TEXT_AD"];?></option>
		<option value="<?php echo HTTP_SERVER_WEBSITE;?>dashboard/advertiser/ad/banner" selected><?php echo $LANG["WBS_ADVERTISER_BANNER_BANNER_AD"];?></option>
	</select>
</div>




<div class="row"><br/></div>
</div>

<div id="new-ad-form" class="col-md-12">



<form id="banner-ad-form" method="post" action="" enctype="multipart/form-data">


<input id="adv-ad-id" name="adv-ad-id" value="<?php echo $ad['0']['aau_id'];?>" style="display:none;"/>


<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_SELECT_CAMPAIGN"];?> ( <a href="<?php echo HTTP_SERVER_WEBSITE;?>dashboard/advertiser/campaign"><?php echo $LANG["WBS_ADVERTISER_BANNER_CREATE_CAMPAIGN"];?></a> )</label>
	<select id="adv-ad-campaign" name="adv-ad-campaign" class="form-control">
		<option value="0"><?php echo $LANG["WBS_ADVERTISER_AD_SELECT_CAMPAIGN_OPTION"];?></option>
			<?php if ( !empty ( $campaigns ) ) { ?>
			<?php foreach($campaigns as $campaign): ?>
				<option value="<?php echo $campaign['adv_campaign_id'];?>" <?php if ( $ad['0']['aau_campaign'] == $campaign['adv_campaign_id'] ) { ?>selected<?php }?>><?php echo $campaign['adv_campaign_title'];?></option>
			<?php endforeach; ?>
			<?php } ?>
	</select>
</div>



<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_TARGET_COUNTRY"];?></label>
	<select id="adv-ad-country" name="adv-ad-country" class="form-control disabled-form">
		<option value="0"><?php echo $LANG["WBS_ADVERTISER_AD_TARGET_COUNTRY_OPTION"];?></option>
			<?php if ( !empty ( $countries ) ) { ?>
			<?php foreach($countries as $country): ?>
				<option value="<?php echo $country['country_id'];?>" <?php if ( $ad['0']['aau_target_country'] == $country['country_id'] ) { ?>selected<?php }?>><?php echo $country['country_name'];?></option>
			<?php endforeach; ?>
			<?php } ?>
	</select>
</div>

<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_AD_TITLE"];?></label>
	<input id="adv-ad-title" name="adv-ad-title" type="text" class="form-control disabled-form" placeholder="<?php echo $LANG["WBS_ADVERTISER_BANNER_PLACEHOLDER_TITLE"];?>" value="<?php echo $ad['0']['aau_title'];?>">
</div>


<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_SELECT_BANNER_SIZE"];?></label>
	<select id="banner-size-value" name="banner-size-value" class="form-control disabled-form">
		<option value=""><?php echo $LANG["WBS_ADVERTISER_BANNER_BANNER_SIZE"];?></option>
			<?php if ( !empty ( $sizes ) ) { ?>
			<?php foreach($sizes as $size): ?>

				<option <?php if ( $get_size['0']['adv_sizes_width'] == $size['adv_sizes_width'] && $get_size['0']['adv_sizes_height'] == $size['adv_sizes_height'] ) { ?>selected<?php }?> data-id="<?php echo $size['adv_sizes_id'];?>" value="<?php echo $size['adv_sizes_width'];?>x<?php echo $size['adv_sizes_height'];?>"><?php echo $size['adv_sizes_name'];?></option>

			<?php endforeach; ?>
			<?php } ?>
	</select>
</div>



<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_SELECT_BANNER"];?></label>
	<input id="banner-image" name="banner-image[]" type="file" class="form-control disabled-form-banner-size">

	<div id="uploadPreview"></div>

</div>

<div class="col-md-12 input-group margin-bottom-10">
	<div id="error-img"></div>
</div>


	<?php if ( !empty ( $ad['0']['aau_file'] ) ) { ?>
		<div class="col-md-12">
		<div class="row">
			<div id="adPreviewImage" class="pull-left">
				<img src="<?php echo HTTP_SERVER_WEBSITE_UPLOADS_BANNER_ADS;?><?php echo $ad['0']['aau_file'];?>"/>
			</div>
		</div>
		</div>
		<input id="validate-banner-image" name="validate-banner-image" value="<?php echo $ad['0']['aau_file'];?>" style="display:none;"/>
	<?php } else { ?>
		<input id="validate-banner-image" name="validate-banner-image" value="" style="display:none;"/>
	<?php } ?>

<div class="col-md-12 input-group margin-bottom-10">
	<label><?php echo $LANG["WBS_ADVERTISER_BANNER_TARGET_URL"];?></label>
	<input id="adv-ad-target-url" name="adv-ad-target-url" type="text" class="form-control disabled-form" placeholder="<?php echo $LANG["WBS_ADVERTISER_BANNER_PLACEHOLDER_PAGE_URL"];?>" value="<?php echo $ad['0']['aau_target_url'];?>">
</div>







</form>



<div class="col-md-12 input-group margin-bottom-10">
	<div id="ad-loader"></div>
</div>



<div class="col-md-12 input-group margin-bottom-10">


<?php if ( $ad['0']['aau_status'] == '3' ) { ?>

	<div class="alert alert-danger" role="alert"><?php echo $LANG["WBS_ADVERTISER_BANNER_DISABLED"];?></div>

<?php } else { ?>




<?php if ( !empty ( $ad ) ) { ?>

	<a href="<?php echo HTTP_SERVER_WEBSITE;?>dashboard/advertiser/keywords?id=<?php echo $ad['0']['aau_id'];?>" class="btn blue-btn pull-right"><?php echo $LANG["WBS_ADVERTISER_AD_MANAGE_KEYWORDS"];?></a>

	<div class="pull-right">&nbsp;&nbsp;&nbsp;</div>

	<button id="ad-banner" type="button" class="btn blue-btn pull-right disabled-form"><?php echo $LANG["WBS_ADVERTISER_BANNER_SUBMIT"];?></button>


<?php } else { ?>
	<button id="ad-banner" type="button" class="btn blue-btn pull-right disabled-form"><?php echo $LANG["WBS_ADVERTISER_BANNER_SUBMIT"];?></button>
<?php } ?>


<?php } ?>

</div>


<div class="row"><br/></div>
</div>


<div class="row"><br/></div>
</div>

</div>
</div>
</div>






<script>
	jQuery(document).ready(function (e) {
	<?php if ( empty ( $ad ) ) { ?>
		$(".disabled-form").attr("disabled", "disabled");
	<?php } else { ?>
		$(".disabled-form").removeAttr('disabled');
	<?php } ?>

	<?php if ( empty ( $ad['0']['aau_file'] ) ) { ?>
		$(".disabled-form-banner-size").attr("disabled", "disabled");
	<?php } ?>
	});
</script>




<?php echo $footer;?>