<?php
mt_srand();
$index = mt_rand(1, 9999);
$front_err = __('front_error', true);
?>
<div id="pjWrapper">
	<div class="container-fluid pjJlContainer">
		<?php include_once dirname(__FILE__) . '/elements/header.php';?>
		
		<div class="pjJlBody">
			<div class="pjJlForm pjJlFormAccess pjJlFormAccessLogin">
				<form action="<?php echo $_SERVER['PHP_SELF'];?>?controller=pjLoad&amp;action=pjActionProfile" method="post" id="frmProfile" name="frmProfile" autocomplete="off" enctype="multipart/form-data" class="form-dyna xs-4 form-profile">
					<input type="hidden" name="profile_update" value="1" />
					<input type="hidden" name="id" value="<?php echo $tpl['arr']['id']; ?>" />
					
					<header class="pjJlFormHead">
						<p class="pjJlFormTitle"><?php __('front_menu_profile');?></p><!-- /.pjJlFormTitle -->
	
					</header><!-- /.pjJlFormHead -->
					
					<div class="row pjJlFormBody">
						<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pjJlFormContent">
							<?php
							if(isset($_GET['err']))
							{
								$reg_message = __('front_profile', true);
								$class = ($_GET['err'] == 'data_inv') ? ' alert-danger' : ' alert-success';
								?>
								<div class="alert<?php echo $class;?>"><?php echo $reg_message[$_GET['err']] ?></div>
								<?php
							} 
							?>
							
							<div class="row">
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_email'); ?>: </label>
										<input type="text" name="email" value="<?php echo pjSanitize::html($tpl['arr']['email']); ?>" class="form-control required email" data-msg-required="<?php echo $front_err['email']?>" data-msg-email="<?php echo $front_err['email_inv']?>" data-msg-remote="<?php echo $front_err['email_used']?>"/>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
							</div>
							<div class="row">
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_password'); ?>: </label>
										<input type="password" id="pjJLProfilePassword" name="password" value="password" class="form-control required" data-msg-required="<?php echo $front_err['password']?>"/>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_cpassword'); ?>: </label>
										<input type="password" name="cpassword" value="password" class="form-control required" data-msg-required="<?php echo $front_err['cpassword']?>" data-msg-equalTo="<?php echo $front_err['password_match']?>"/>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
							</div>
							<div class="row">
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_fname'); ?>: </label>
										<input type="text" name="fname" value="<?php echo pjSanitize::html($tpl['arr']['fname']); ?>" class="form-control required" data-msg-required="<?php echo $front_err['fname']?>"/>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_lname'); ?>: </label>
										<input type="text" name="lname" value="<?php echo pjSanitize::html($tpl['arr']['lname']); ?>" class="form-control required" data-msg-required="<?php echo $front_err['lname']?>"/>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
							</div>
							<div class="row">
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_phone'); ?>: </label>
										<input type="text" name="phone" value="<?php echo pjSanitize::html($tpl['arr']['phone']); ?>" class="form-control"/>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_linkedin'); ?>: </label>
										<input type="text" name="linkedin" value="<?php echo pjSanitize::html($tpl['arr']['linkedin']); ?>" class="form-control"/>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
							</div>
							<div class="row">
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
									<div class="form-group">
										<label for=""><?php __('front_label_cv'); ?>: </label>
									
										<div class="row pjJlAddFile">
											<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
												<input type="text" class="form-control pjJlUploadedFiles" placeholder="<?php __('front_choose_file');?>" />
											</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
									
											<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
												<div class="btn btn-default pjJlBtn pjJlBtnSecondary pjJlBtnUpload">
													<?php __('front_btn_browse');?>
																								
													<input type="file" name="cv" class="pjJlFileUploadField" />
												</div>
																								
												<a href="#" class="btn btn-default pjJlBtn pjJlBtnBordered pjJlBtnRemoveFile" style="display: none;"><?php __('front_btn_delete');?></a>
											</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
										</div><!-- /.row pjJlAddFile -->
									
									</div><!-- /.form-group -->
								</div>
								<?php
								if(isset($tpl['file_arr']))
								{ 
									$file = $tpl['file_arr'];
									if(!empty($file['file_path']))
									{
										$file_path = PJ_INSTALL_PATH . $file['file_path'];
										$file_url = PJ_INSTALL_URL . $file['file_path'];
										if(file_exists($file_path))
										{
											?>
											<div id="pjJLCVContainer_<?php echo $index;?>">
												<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
													<div class="form-group">
														<label><?php echo $file['file_name'];?></label><br/>
														<a target="_blank" href="<?php echo PJ_INSTALL_URL;?>index.php?controller=pjLoad&action=pjActionDownloadFile&id=<?php echo $file['id']; ?>&hash=<?php echo $file['hash']?>"><i class="fa fa-download"></i>&nbsp;<?php echo mb_strtolower(__('front_link_download', true), 'UTF-8');?></a>&nbsp;&nbsp;&nbsp;
														<a data-id="<?php echo $file['id'];?>" data-hash="<?php echo $file['hash'];?>" href="#" class="pjULOpenDeleteModal"><i class="fa fa-trash-o"></i>&nbsp;<?php echo strtolower(__('front_link_delete', true));?></a>
													</div><!-- /.form-group -->
												</div>
											</div>
											
											<div class="modal fade" id="pjJLDeleteCVModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
											  	<div class="modal-dialog" role="document">
											    	<div class="modal-content">
											      		<div class="modal-body">
											        		<?php __('front_label_cv_confirm');?>
											      		</div>
											      		<div class="modal-footer">
											        		<button type="button" class="btn btn-default" data-dismiss="modal"><?php __('front_btn_close');?></button>
											        		<button id="pjJLDeleteButton_<?php echo $index;?>" type="button" class="btn btn-primary pjMLDeletePhoto" data-id="<?php echo $tpl['arr']['id'];?>" data-hash="<?php echo $file['hash'];?>"><?php __('front_btn_delete');?></button>
											      		</div>
											    	</div>
											  	</div>
											</div>
											<?php
										}
									}
								} 
								?>
								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pjJlFormActions">
									<button type="submit" class="btn btn-default pjJlBtn pjJlBtnPrimary"><?php __('front_button_save');?></button>
								</div><!-- /.col-lg-12 col-md-12 col-sm-12 col-xs-12 pjJlFormActions -->
							</div>
						</div><!-- /.col-lg-12 col-md-12 col-sm-12 col-xs-12 pjJlFormContent -->
					</div><!-- /.row pjJlFormBody -->
				</form><!-- form -->
			</div><!-- /.pjJlForm pjJlFormAccess pjJlFormAccessLogin -->
		</div><!-- /.pjJlBody -->
	</div><!-- /.container-fluid pjJlContainer -->
</div><!-- /.pjWrapper -->

<?php include_once dirname(__FILE__) . '/elements/loadjs.php';?>