Skip to content

Commit

Permalink
Merge branch 'dev-hiresuit' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinjohn22 committed Dec 19, 2024
2 parents 108e276 + 965726d commit 7a9e99e
Show file tree
Hide file tree
Showing 22 changed files with 225 additions and 125 deletions.
26 changes: 25 additions & 1 deletion admin/class-awsm-job-openings-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public function __construct() {
}
}
add_action( 'awsm_job_applicant_profile_details_resume_preview', array( $this, 'docs_viewer_handle' ) );
add_filter( 'post_row_actions', array( $this, 'awsm_job_application_row_actions_label' ), 10, 2 );
add_filter( 'wp_untrash_post_status', array( $this, 'awsm_job_application_restore_post_to_previous_status' ), 10, 3 );

}

public static function init() {
Expand Down Expand Up @@ -52,7 +55,7 @@ public function awsm_register_meta_boxes() {
$attachment_post = get_post( $awsm_attachment_id );
if ( $attachment_post && $attachment_post->post_type === 'attachment' ) {
add_meta_box( 'awsm-job-resume-preview', esc_html__( 'Resume Preview', 'wp-job-openings' ), array( $this, 'awsm_job_application_attachment_preview' ), 'awsm_job_application', 'normal', 'high' );
}
}
}
}

Expand Down Expand Up @@ -308,5 +311,26 @@ public function application_delete_action( $application_id ) {
</div>
<?php
}
public function awsm_job_application_row_actions_label( $actions, $post ) {
if ( $post->post_type === 'awsm_job_application' ) {
if ( isset( $actions['edit'] ) ) {
$actions['edit'] = str_replace( __( 'Edit' ), __( 'View' ), $actions['edit'] );
}
}
return $actions;
}

public function awsm_job_application_restore_post_to_previous_status( $new_status, $post_id, $previous_status ) {
$post = get_post( $post_id );

if ( $post && $post->post_type === 'awsm_job_application' ) {
if ( ! empty( $previous_status ) && $previous_status !== 'trash' ) {
return $previous_status;
}

return 'publish';
}

return $new_status;
}
}
10 changes: 7 additions & 3 deletions admin/class-awsm-job-openings-overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function redirect_to_overview() {
}
}


public function register_overview_widgets() {
$widgets = array(
'applications-analytics' => array(
Expand Down Expand Up @@ -177,7 +178,8 @@ public static function get_jobs( $args ) {
$parsed_args = apply_filters( 'awsm_overview_jobs_args', $parsed_args, $defaults );

$values = array();
$join = "LEFT JOIN {$wpdb->posts} AS applications ON {$wpdb->posts}.ID = applications.post_parent AND applications.post_type = 'awsm_job_application'";
//$join = "LEFT JOIN {$wpdb->posts} AS applications ON {$wpdb->posts}.ID = applications.post_parent AND applications.post_type = 'awsm_job_application'";
$join = "LEFT JOIN {$wpdb->posts} AS applications ON {$wpdb->posts}.ID = applications.post_parent AND applications.post_type = 'awsm_job_application' AND applications.post_status != 'trash'";
$where = 'WHERE 1=1';
if ( isset( $parsed_args['tax_query'] ) && is_array( $parsed_args['tax_query'] ) ) {
$in = array();
Expand Down Expand Up @@ -252,10 +254,11 @@ public static function get_jobs( $args ) {
return apply_filters( 'awsm_overview_jobs', $results, $parsed_args );
}

public static function get_jobs_by_author( $numberjobs = 10 ) {
public static function get_jobs_by_author( $numberjobs = 7 ) {
$args = array(
'numberjobs' => $numberjobs,
'author_id' => get_current_user_id(),
'job_status' => 'publish',
);
return self::get_jobs( $args );
}
Expand All @@ -265,7 +268,7 @@ public static function get_applications_analytics_data( $date_query = array(), $
if ( ! current_user_can( 'edit_applications' ) ) {
return $analytics_data;
}

$analytics_option = get_option( 'awsm_jobs_analytics_data' );
if ( empty( $date_query ) ) {
$date_query = array(
array(
Expand Down Expand Up @@ -297,4 +300,5 @@ public static function get_applications_analytics_data( $date_query = array(), $
}
return $analytics_data;
}

}
3 changes: 2 additions & 1 deletion admin/templates/meta/applicant-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
$resume_details = $this->get_attached_file_details( $attachment_id );
$full_file_name = get_post_meta( $attachment_id, 'awsm_actual_file_name', true );
$applicant_job_id = get_post_meta( $post->ID, 'awsm_job_id', true );
$resume_field_label = ( new AWSM_Job_Openings_Form() )->dynamic_form_fields( $applicant_job_id )['awsm_file']['label'];
$resume_field_label = ( new AWSM_Job_Openings_Form() )->get_attachment_label( $applicant_job_id );
$this->is_main_applicant_viewed( $post->ID );

/**
* Initialize applicant meta box.
*
Expand Down
65 changes: 35 additions & 30 deletions admin/templates/overview/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
exit;
}

$user_obj = wp_get_current_user();
$overview_data = AWSM_Job_Openings::get_overview_data();
$active_jobs = intval( $overview_data['active_jobs'] );
$new_applications = intval( $overview_data['new_applications'] );
$total_applications = intval( $overview_data['total_applications'] );

$user_obj = wp_get_current_user();
$overview_data = AWSM_Job_Openings::get_overview_data();
$active_jobs = intval( $overview_data['active_jobs'] );
$new_applications = intval( $overview_data['new_applications'] );
$total_applications = intval( $overview_data['total_applications'] );
$total_active_applications = intval( $overview_data['active_applications'] );
$applications_count = intval( $overview_data['unread_applications'] );
// Enable meta-box support.
do_action( 'add_meta_boxes_' . AWSM_Job_Openings_Overview::$screen_id, null );

Expand All @@ -26,6 +27,7 @@
set_transient( '_awsm_add_ons_data', $response_body, DAY_IN_SECONDS );
}
}

?>
<div class="wrap">
<h1></h1>
Expand All @@ -45,9 +47,9 @@
if ( $active_jobs === 0 ) {
esc_html_e( "Welcome to WP Job Openings! Let's get started?", 'wp-job-openings' );
} else {
if ( current_user_can( 'edit_others_applications' ) && $new_applications > 0 ) {
if ( current_user_can( 'edit_others_applications' ) && $applications_count > 0 ) {
/* translators: %s: New applications count */
printf( esc_html__( 'You have %s new applications to review', 'wp-job-openings' ), esc_html( $new_applications ) );
printf( esc_html__( 'You have %s new applications to review', 'wp-job-openings' ), esc_html( $applications_count ) );
}
}
?>
Expand All @@ -73,12 +75,12 @@
<li>
<img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-2.svg' ); ?>" align="Icon">
<?php esc_html_e( 'New Applications', 'wp-job-openings' ); ?>
<span><?php echo esc_html( $new_applications ); ?></span>
<span><?php echo esc_html( $applications_count ); ?></span>
</li>
<li>
<img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-3.svg' ); ?>" align="Icon">
<?php esc_html_e( 'Total Applications', 'wp-job-openings' ); ?>
<span><?php echo esc_html( $total_applications ); ?></span>
<span><?php echo esc_html( $total_active_applications ); ?></span>
</li>
<?php endif; ?>
</ul>
Expand Down Expand Up @@ -124,15 +126,16 @@
<div class="awsm-jobs-overview-chart flex-item">
<div class="awsm-jobs-overview-col-head">
<h2><?php esc_html_e( 'Application Analytics', 'wp-job-openings' ); ?></h2>


<?php
$widget_id = 'awsm-jobs-overview-applications-by-analytics';
// Include your template here
require AWSM_JOBS_PLUGIN_DIR . '/admin/templates/overview/widgets/applications-analytics.php';
?>
<!-- Replace this image with chart.js -->

</div><!-- .awsm-jobs-overview-col-head -->
<div class="awsm-jobs-overview-col-content">
<?php
$widget_id = 'awsm-jobs-overview-applications-by-analytics';
// Include your template here
require AWSM_JOBS_PLUGIN_DIR . '/admin/templates/overview/widgets/applications-analytics.php';
?>
<!-- Replace this image with chart.js -->
</div><!-- .awsm-jobs-overview-col-content -->
</div><!-- .awsm-jobs-overview-chart -->
</div><!-- .awsm-jobs-overview-col -->
<div class="awsm-jobs-overview-col">
Expand Down Expand Up @@ -164,7 +167,7 @@
'link_text' => __( 'Get Support', 'wp-job-openings' ),
),
);


/**
* Filters the overview get started widget links.
Expand Down Expand Up @@ -230,13 +233,13 @@
<?php endforeach; ?>
<?php else : ?>
<div class="awsm-jobs-overview-empty-wrapper">
<p>📂 <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
<p><img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-3.svg' ); ?>" align="Icon"> <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
</div>
<?php endif; ?>
</div><!-- .awsm-jobs-overview-list -->
</div><!-- .awsm-jobs-overview-col -->
<div class="awsm-jobs-overview-col">
<div class="awsm-jobs-overview-list flex-item">
<div class="awsm-jobs-overview-list awsm-jobs-overview-positions flex-item">
<div class="awsm-jobs-overview-col-head">
<h2><?php esc_html_e( 'Open Job Positions', 'wp-job-openings' ); ?></h2>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=awsm_job_openings' ) ); ?>">
Expand All @@ -246,10 +249,11 @@
</svg>
</a>
</div><!-- .awsm-jobs-overview-col-head -->
<div class="awsm-jobs-overview-col-content">

<?php
if ( ! empty( $jobs ) ) :
foreach ( $jobs as $job ) :
if ( ! empty( $jobs ) ) : ?>
<div class="awsm-jobs-overview-col-content">
<?php foreach ( $jobs as $job ) :
$jobmeta = get_post_meta( $job->ID );
$expiry_date = isset( $jobmeta['awsm_job_expiry'][0] ) ? $jobmeta['awsm_job_expiry'][0] : null;

Expand All @@ -259,7 +263,7 @@
$published_date = get_the_date( 'F j, Y', $job->ID );
?>
<a href="<?php echo esc_url( get_edit_post_link( $job->ID ) ); ?>" class="awsm-jobs-overview-list-item">
<span class="count"><?php echo esc_html( $job->applications_count ); ?></span>
<span class="count"><?php echo esc_html( $job->applications_count ); ?></span>
<p>
<strong>
<?php
Expand All @@ -278,19 +282,20 @@
</a>
<?php
endif;
endforeach;
else :
endforeach; ?>
</div>
<?php else :
?>
<div class="awsm-jobs-overview-empty-wrapper">
<p>💼
<p><img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-1.svg' ); ?>" align="Icon">
<?php
/* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */
printf( '&nbsp;' . esc_html__( 'Looks empty! %1$sAdd some%2$s', 'wp-job-openings' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=awsm_job_openings' ) ) . '">', '</a>' );
printf( '&nbsp;' . esc_html__( 'It Looks empty here! %1$sAdd a Job Opening%2$s', 'wp-job-openings' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=awsm_job_openings' ) ) . '">', '</a>' );
?>
</p>
</div>
<?php endif; ?>
</div>

</div><!-- .awsm-jobs-overview-list -->
</div><!-- .awsm-jobs-overview-col -->
<div class="awsm-jobs-overview-col">
Expand Down
15 changes: 10 additions & 5 deletions admin/templates/overview/widgets/applications-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="<?php echo esc_attr( "awsm-jobs-overview-widget-wrapper awsm-jobs-overview-{$widget_id}-widget-wrapper" ); ?>">
<?php
/**
/**
* Fires before the overview widget content.
*
* @since 3.0.0
*
* @param string $widget_id Overview widget ID.
*/
do_action( 'before_awsm_jobs_overview_widget_content', $widget_id );
?>
<div class="awsm-jobs-overview-col-content">
<div class="<?php echo esc_attr( "awsm-jobs-overview-widget-wrapper awsm-jobs-overview-{$widget_id}-widget-wrapper" ); ?>">
<?php


$analytics_data = AWSM_Job_Openings_Overview::get_applications_analytics_data();

if ( ! empty( $analytics_data ) ) :
?>
<div class="awsm-jobs-overview-chart-wrapper">
<canvas id="awsm-jobs-overview-applications-analytics-chart"></canvas>
</div>

<?php else : ?>
<div class="awsm-jobs-overview-empty-wrapper">
<img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/applications-analytics-chart.png' ); ?>">
<p>📂 <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
<p><img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-3.svg' ); ?>" align="Icon"> <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
</div>
<?php
endif;
Expand All @@ -39,3 +43,4 @@
do_action( 'after_awsm_jobs_overview_widget_content', $widget_id );
?>
</div>
</div>
4 changes: 2 additions & 2 deletions admin/templates/overview/widgets/job-listings.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
</table>
<?php else : ?>
<div class="awsm-jobs-overview-empty-wrapper">
<p>💼
<p><img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-1.svg' ); ?>" align="Icon">
<?php
/* translators: %1$s: opening anchor tag, %2$s: closing anchor tag */
printf( '&nbsp;' . esc_html__( 'Looks empty! %1$sAdd some%2$s', 'wp-job-openings' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=awsm_job_openings' ) ) . '">', '</a>' );
printf( '&nbsp;' . esc_html__( 'It Looks empty here! %1$sAdd a Job Opening%2$s', 'wp-job-openings' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=awsm_job_openings' ) ) . '">', '</a>' );
?>
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/overview/widgets/recent-applications.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

<?php else : ?>
<div class="awsm-jobs-overview-empty-wrapper">
<p>📂 <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
<p><img src="<?php echo esc_url( AWSM_JOBS_PLUGIN_URL . '/assets/img/icon-3.svg' ); ?>" align="Icon"> <?php esc_html_e( 'Awaiting applications', 'wp-job-openings' ); ?></p>
</div>
<?php
endif;
Expand Down
Loading

0 comments on commit 7a9e99e

Please sign in to comment.