<?php 

function upload_signature_cb() {
    if(!isset($_GET['id'])) {
        global $app;
        $user_meta = $app->user_meta;
    } else {
        if(!current_user_can("edit_others_signature")) {
            return_method();
        }
        $user = new user;
        $user_meta = $user->get_user_meta($_GET['id']);
    }
	$signature = isset($user_meta['signature']) ? $user_meta['signature'] : "contents/plugins/eedu_portal/images/upload-signature.jpg";
	global $post_meta;
	?>
	<div>
        <div class="card">
            <div class="card-header">
                <strong class="card-title">Signature Card</strong>
            </div>
            <div class="card-body">
            	<form method="post" action="contents/plugins/eedu_portal/ajax.php" id="form" enctype="multipart/form-data">
                    <input type="hidden" name="id" id="id" value="<?php echo $user_meta['id'] ?>">
            		<?php 
                        do_action('croppie_api', ['width' => 200, 'height' => 80, 'url' => $signature, 'image-name' => 'signature', 'enable_resize' => true]);
            			input(['label' => 'Designation', 'id' => 'designation', 'value' => $user_meta['designation']]);
            			alert(); submit_btn('upload_signature', 'Save Settings');
            		?>	
            	</form>
                
            </div>
        </div>
    </div>
	<?php
	add_page_javascript('app/assets/js/page-scripts/submit.js');
}