<?php 

function edit_category_cb() {
	global $post_meta;
	$post = new post;
	if(!isset($_GET['id']))
		return_method();
	$category_meta = $post->get_post_meta($_GET['id']);
	?>
	<div class="col-md-6">
		<div class="card card-primary">
			<div class="card-header">
				<h3>Edit Category</h3>
			</div>
			<div class="card-body">
				<form method="post" action="contents/plugins/eedu_portal/ajax.php" id="edit_category_form">
					<?php 
						input(['label' => '', 'id' => 'id', 'type' => 'hidden', 'value' => $category_meta['id']]);
						input(['label' => 'Category Name', 'id' => 'category_name', 'value' => $category_meta['category_name'], 'required' => 'required']);
						input(['label' => 'Order', 'id' => 'order', 'required' => 'required', 'class' => 'form-control numbers-only', 'value' => $category_meta['order'], 'hint' => 'This is the order for promotion. To be serialized in ascending order. Each class bear a unique order.']);
						submit_btn('edit_category', 'Update');
					?>
				</form>
			</div>
		</div>
	</div>

	<?php
	add_page_javascript('app/assets/js/page-scripts/submit.js');
}