View file funding_acquisition/templates/funding_acquisition/index.html

File size: 5.6Kb
<div class="page-margin">
	<div class="pg_page padd">
		<h2 class="user_sttng_panel_hd">{{LANG funding}}</h2>
		<form class="form pp_sett_form" id="create_fund" enctype="multipart/form-data">
			<div class="row">
				<div class="col-md-8">
					<div class="pg_mat_input">
						<input type="text" name="title" placeholder="{{LANG title}}" required="true">
						<label>{{LANG title}}</label>
					</div>
				</div>
				<div class="col-md-4">
					<div class="pg_mat_input">
						<input required="true" type="text" name="amount" placeholder="{{LANG amount}}">
						<label>{{LANG amount}}</label>
					</div>
				</div>
			</div>
			<div class="pg_mat_input">
				<textarea placeholder="{{LANG description}}" name="description" rows="6"></textarea>
				<label>{{LANG description}}</label>
			</div>
			<div class="fak_image pg_fak_img pk_ad_fak_img" onclick="document.getElementById('image').click(); return false">
				<div class="upload_fk_image">
					<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><path d="m256 512c-64.349 0-129.788-2.237-194.5-6.649l-7.639-.521c-10.546-.719-19.053-8.906-20.176-19.416l-.814-7.614c-9.706-90.844-9.706-182.967 0-273.81l.814-7.614c1.123-10.51 9.63-18.697 20.176-19.416l7.639-.521c64.72-4.412 130.159-6.649 194.5-6.649 64.342 0 129.781 2.237 194.5 6.649l7.639.521c10.546.719 19.053 8.906 20.176 19.416l.814 7.613c9.707 90.844 9.707 182.967 0 273.811l-.814 7.613c-1.123 10.51-9.63 18.697-20.176 19.416l-7.639.521c-64.712 4.413-130.15 6.65-194.5 6.65z" fill="#dfeaef"></path><path d="m448.402 474.512c-64.074 4.382-128.599 6.582-192.41 6.582-63.792 0-128.318-2.2-192.392-6.582-2.915-27.288-4.946-54.652-6.075-82.035-2.52-61.761-.508-123.654 6.075-185.208 64.074-4.363 128.599-6.582 192.392-6.582 26.536 0 53.185.376 79.872 1.147 37.519 1.072 75.095 2.877 112.539 5.435 2.313 21.628 4.062 43.312 5.228 64.996 1.091 19.521 1.693 39.043 1.862 58.564.376 47.957-1.994 95.914-7.091 143.683z" fill="#6bbef6"></path><path d="m452.803 423.546c-1.129 17.001-2.595 34.003-4.401 50.966-64.074 4.382-128.599 6.582-192.41 6.582-63.792 0-128.318-2.2-192.392-6.582-1.034-9.667-1.956-19.333-2.746-29-1.486-17.659-2.595-35.338-3.329-53.035h.019c61.761 0 112.426-106.784 181.841-76.75 69.415 30.015 112.05 86.36 216.069 15.026l.038.075c.245 30.919-.658 61.838-2.689 92.718z" fill="#86f1a7"></path><path d="m452.803 423.546c-1.129 17.001-2.595 34.003-4.401 50.966-64.074 4.382-128.599 6.582-192.41 6.582-63.792 0-128.318-2.2-192.392-6.582-1.034-9.667-1.956-19.333-2.746-29 .001 0 205.726-21.966 391.949-21.966z" fill="#66b49d"></path><g><circle cx="360.366" cy="273.394" fill="#f4dd45" r="45.22"></circle></g></g><path d="m337.231 96.515-68.095-92.032c-4.423-5.978-13.366-5.978-17.789 0l-68.095 92.032c-5.403 7.303-.19 17.645 8.894 17.645h14.251c6.111 0 11.064 4.954 11.064 11.064v92.383c0 6.111 4.954 11.064 11.064 11.064h63.432c6.111 0 11.064-4.954 11.064-11.064v-92.383c0-6.111 4.954-11.064 11.064-11.064h14.251c9.085.001 14.298-10.342 8.895-17.645z" fill="#617881"></path></g></svg>
					<p>{{LANG upload_file}}</p>
				</div>
				<div id="fake_img_holder"></div>
			</div>
			<input type="file" id="image" name="image" class="hidden">
			<input type="hidden" name="hash" value="<?php echo($context['csrf_token']) ?>">
			<div class="pg_sett_save"><button class="btn btn-main btn-mat btn-mat-raised pp_flat_btn" type="submit"><span>{{LANG submit}}</span></button></div>
		</form>
	</div>
</div>

<script type="text/javascript">
jQuery(document).ready(function($) {
    $("form#create_fund").ajaxForm({
        url: link('profile/create_fund'),
        type: 'POST',
        dataType: 'json',
        beforeSubmit: function(arr,form){
            $(form).find('.pp_load_loader').addClass('loadingg');
            $(form).find('button[type="submit"]').attr('disabled','true');
        },
        success: function(data,stat,xhr,form){
            scroll2top();
            $.toast(data.message,{
                duration: 5000, 
                type: 'success',
                align: 'bottom',
                singleton: true
            });
            if (data.status == 200) {
                setTimeout(function () {
                    window.location.href = "{{CONFIG site_url}}/funding";
                },2000);
            }
            $(form).find('.pp_load_loader').removeClass('loadingg');
            $(form).find('button[type="submit"]').removeAttr('disabled');
        }
    });
});

$(document).ready(function() {
	$("#image").on('change', function() {
	//Get count of selected files
	var product_countFiles = $(this)[0].files.length;
	var product_imgPath = $(this)[0].value;
	var extn = product_imgPath.substring(product_imgPath.lastIndexOf('.') + 1).toLowerCase();
	var product_image_holder = $("#fake_img_holder");
	product_image_holder.empty();
	if (extn == "gif" || extn == "png" || extn == "jpg" || extn == "jpeg") {
		if (typeof(FileReader) != "undefined") {
		//loop for each file selected for uploaded.
		for (var i = 0; i < product_countFiles; i++) 
		{
			var product_reader = new FileReader();
			product_reader.onload = function(e) {
				$("<img />", {
                    "src": e.target.result,
                    "class": "thumb-image"
                  }).appendTo(product_image_holder);
                }
                product_image_holder.show();
                product_reader.readAsDataURL($(this)[0].files[i]);
              }
            } else {
              product_image_holder.html("<p>This browser does not support FileReader.</p>");
            }
         }
	});
});
</script>