<div class="page-margin">
	<div class="row">
		<div class="col-md-2 leftcol"><?php echo Wo_LoadPage("sidebar/left-sidebar"); ?></div>
		<div class="col-md-10 singlecol wo-create-forms">
			<div class="page-margin wow_content mt-0">
				<div class="wo_page_hdng pag_neg_padd pag_alone">
					<div class="wo_page_hdng_innr">
						<span><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M18 11H6A2 2 0 0 0 4 13V21A2 2 0 0 0 6 23H18A2 2 0 0 0 20 21V13A2 2 0 0 0 18 11M18 17H6V14H18M17 5V10H15.5V6.5H9.88L12.3 8.93L11.24 10L7 5.75L11.24 1.5L12.3 2.57L9.88 5Z"></path></svg></span> <?php echo $wo['lang']['edit_funding'];?>
					</div>
				</div>
			</div>
		  
			<div class="page-margin wow_content wow_sett_content">
				<form class="form form-horizontal create-article-form" method="post" id="insert-funding" action="#">
					<div class="wow_form_fields">
						<label for="title"><?php echo $wo['lang']['title']; ?></label>
						<input id="title" name="title" type="text" value="<?php echo($wo['fund']['title']) ?>">
					</div>
					<div class="wow_form_fields">
						<label for="amount"><?php echo $wo['lang']['fund_amount']; ?></label>
						<input id="amount" name="amount" type="text" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');" value="<?php echo($wo['fund']['amount']) ?>">
					</div>
					<div class="wow_form_fields">
						<label for="description"><?php echo $wo['lang']['description']; ?></label>
						<textarea name="description" id="description" type="text" rows="6"><?php echo($wo['fund']['description']); ?></textarea>
					</div>
					
					<div class="setting-update-alert" id="funding-alert"></div>
					
					<div class="text-center">
						<a class="btn btn-mat" data-ajax="?link1=my_funding" href="<?php echo Wo_SeoLink('index.php?link1=my_funding');?>">
							<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="currentColor" d="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"></path></svg> <?php echo $wo['lang']['go_back'];?>
						</a>
						<button class="btn btn-main btn-mat btn-mat-raised add_wow_loader" type="submit"><?php echo $wo['lang']['publish']; ?></button>
					</div>
					<input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
					<input type="hidden" name="id" value="<?php echo($wo['fund']['id']) ?>">
				</form>
			</div>
		</div>
	</div>
	<!-- .row -->
</div>

<script src="<?php echo $wo['config']['theme_url'];?>/javascript/bootstrap-tagsinput-latest/src/bootstrap-tagsinput.js"></script>
<script>
jQuery(document).ready(function($) {

    $('#insert-funding').ajaxForm({
      url: Wo_Ajax_Requests_File() + '?f=funding&s=edit_funding',
      beforeSend: function() {
        $('.wo_settings_page').find('.add_wow_loader').addClass('btn-loading');
      },
      success: function(data) {
        if (data['status'] == 200) {
          $("#funding-alert").html('<div class="alert alert-success">'+ data['message'] +'</div>');
          window.location = data.url;
        } else if (data['message']) {
          $("#funding-alert").html('<div class="alert alert-danger">' + data['message'] + '</div>');
        } 
        $('.wo_settings_page').find('.add_wow_loader').removeClass('btn-loading');
      }});
 });

</script> 