ai parsing update
This commit is contained in:
parent
a669564e6d
commit
22870af025
454
ATS_PRODUCT_DOCUMENT.md
Normal file
454
ATS_PRODUCT_DOCUMENT.md
Normal file
@ -0,0 +1,454 @@
|
||||
# KAAUH Applicant Tracking System (ATS) - Product Document
|
||||
|
||||
## 1. Product Overview
|
||||
|
||||
### 1.1 Product Description
|
||||
The King Abdulaziz University Hospital (KAAUH) Applicant Tracking System (ATS) is a comprehensive recruitment management platform designed to streamline and optimize the entire hiring process. The system provides end-to-end functionality for job posting, candidate management, interview coordination, and integration with external recruitment platforms.
|
||||
|
||||
### 1.2 Target Users
|
||||
- **System Administrators**: Manage system configurations, user accounts, and integrations
|
||||
- **Hiring Managers**: Create job postings, review candidates, and make hiring decisions
|
||||
- **Recruiters**: Manage candidate pipelines, conduct screenings, and coordinate interviews
|
||||
- **Interviewers**: Schedule and conduct interviews, provide feedback
|
||||
- **Candidates**: Apply for positions, track application status, and participate in interviews
|
||||
- **External Agencies**: Submit candidates and track progress
|
||||
|
||||
### 1.3 Key Features
|
||||
- **Job Management**: Create, edit, and publish job postings with customizable templates
|
||||
- **Candidate Pipeline**: Track candidates through all stages of recruitment
|
||||
- **Interview Scheduling**: Automated scheduling with calendar integration
|
||||
- **Video Interviews**: Zoom integration for seamless virtual interviews
|
||||
- **Form Builder**: Dynamic application forms with custom fields
|
||||
- **LinkedIn Integration**: Automated job posting and profile synchronization
|
||||
- **Reporting & Analytics**: Comprehensive dashboards and reporting tools
|
||||
- **Multi-language Support**: Arabic and English interfaces
|
||||
|
||||
## 2. User Stories
|
||||
|
||||
### 2.1 Hiring Manager Stories
|
||||
```
|
||||
As a Hiring Manager, I want to:
|
||||
- Create job postings with detailed requirements and qualifications
|
||||
- Review and shortlist candidates based on predefined criteria
|
||||
- Track the status of all recruitment activities
|
||||
- Generate reports on hiring metrics and trends
|
||||
- Collaborate with recruiters and interviewers
|
||||
- Post jobs directly to LinkedIn
|
||||
|
||||
Acceptance Criteria:
|
||||
- Can create job postings with rich text descriptions
|
||||
- Can filter candidates by stage, skills, and match score
|
||||
- Can view real-time recruitment metrics
|
||||
- Can approve or reject candidates
|
||||
- Can post jobs to LinkedIn with one click
|
||||
```
|
||||
|
||||
### 2.2 Recruiter Stories
|
||||
```
|
||||
As a Recruiter, I want to:
|
||||
- Source and screen candidates from multiple channels
|
||||
- Move candidates through the recruitment pipeline
|
||||
- Schedule interviews and manage availability
|
||||
- Send automated notifications and updates
|
||||
- Track candidate engagement and response rates
|
||||
- Maintain a database of potential candidates
|
||||
|
||||
Acceptance Criteria:
|
||||
- Can bulk import candidates from CSV files
|
||||
- Can update candidate stages in bulk
|
||||
- Can schedule interviews with calendar sync
|
||||
- Can send automated email/SMS notifications
|
||||
- Can track candidate communication history
|
||||
```
|
||||
|
||||
### 2.3 Interviewer Stories
|
||||
```
|
||||
As an Interviewer, I want to:
|
||||
- View my interview schedule and availability
|
||||
- Join video interviews seamlessly
|
||||
- Provide structured feedback for candidates
|
||||
- Access candidate information and resumes
|
||||
- Confirm or reschedule interviews
|
||||
- View interview history and patterns
|
||||
|
||||
Acceptance Criteria:
|
||||
- Receive email/SMS reminders for upcoming interviews
|
||||
- Can join Zoom meetings with one click
|
||||
- Can submit structured feedback forms
|
||||
- Can access all candidate materials
|
||||
- Can update interview status and availability
|
||||
```
|
||||
|
||||
### 2.4 Candidate Stories
|
||||
```
|
||||
As a Candidate, I want to:
|
||||
- Search and apply for relevant positions
|
||||
- Track my application status in real-time
|
||||
- Receive timely updates about my application
|
||||
- Participate in virtual interviews
|
||||
- Submit required documents securely
|
||||
- Communicate with recruiters easily
|
||||
|
||||
Acceptance Criteria:
|
||||
- Can create a profile and upload resumes
|
||||
- Can search jobs by department and keywords
|
||||
- Can track application status history
|
||||
- Can schedule interviews within available slots
|
||||
- Can receive notifications via email/SMS
|
||||
- Can access all application materials
|
||||
```
|
||||
|
||||
### 2.5 System Administrator Stories
|
||||
```
|
||||
As a System Administrator, I want to:
|
||||
- Manage user accounts and permissions
|
||||
- Configure system settings and integrations
|
||||
- Monitor system performance and usage
|
||||
- Generate audit logs and reports
|
||||
- Manage integrations with external systems
|
||||
- Ensure data security and compliance
|
||||
|
||||
Acceptance Criteria:
|
||||
- Can create and manage user roles
|
||||
- Can configure API keys and integrations
|
||||
- Can monitor system health and performance
|
||||
- Can generate audit trails for all actions
|
||||
- Can backup and restore data
|
||||
- Can ensure GDPR compliance
|
||||
```
|
||||
|
||||
## 3. Functional Requirements
|
||||
|
||||
### 3.1 Job Management Module
|
||||
#### 3.1.1 Job Creation & Editing
|
||||
- **FR1.1.1**: Users must be able to create new job postings with all required fields
|
||||
- **FR1.1.2**: System must auto-generate unique internal job IDs
|
||||
- **FR1.1.3**: Users must be able to edit job postings at any stage
|
||||
- **FR1.1.4**: System must support job cloning for similar positions
|
||||
- **FR1.1.5**: System must support multi-language content
|
||||
|
||||
#### 3.1.2 Job Publishing & Distribution
|
||||
- **FR1.2.1**: System must support job status management (Draft, Active, Closed)
|
||||
- **FR1.2.2**: System must integrate with LinkedIn for job posting
|
||||
- **FR1.2.3**: System must generate career pages for active jobs
|
||||
- **FR1.2.4**: System must support application limits per job posting
|
||||
- **FR1.2.5**: System must track application sources and effectiveness
|
||||
|
||||
### 3.2 Candidate Management Module
|
||||
#### 3.2.1 Candidate Database
|
||||
- **FR2.1.1**: System must store comprehensive candidate profiles
|
||||
- **FR2.1.2**: System must parse and analyze uploaded resumes
|
||||
- **FR2.1.3**: System must support candidate import from various sources
|
||||
- **FR2.1.4**: System must provide candidate search and filtering
|
||||
- **FR2.1.5**: System must calculate match scores for candidates
|
||||
|
||||
#### 3.2.2 Candidate Pipeline
|
||||
- **FR2.2.1**: System must support customizable candidate stages
|
||||
- **FR2.2.2**: System must enforce stage transition rules
|
||||
- **FR2.2.3**: System must track all candidate interactions
|
||||
- **FR2.2.4**: System must support bulk candidate operations
|
||||
- **FR2.2.5**: System must provide candidate relationship management
|
||||
|
||||
### 3.3 Interview Management Module
|
||||
#### 3.3.1 Interview Scheduling
|
||||
- **FR3.1.1**: System must support automated interview scheduling
|
||||
- **FR3.1.2**: System must integrate with calendar systems
|
||||
- **FR3.1.3**: System must handle timezone conversions
|
||||
- **FR3.1.4**: System must support buffer times between interviews
|
||||
- **FR3.1.5**: System must prevent scheduling conflicts
|
||||
|
||||
#### 3.3.2 Video Interviews
|
||||
- **FR3.2.1**: System must integrate with Zoom for video interviews
|
||||
- **FR3.2.2**: System must create Zoom meetings automatically
|
||||
- **FR3.2.3**: System must handle meeting updates and cancellations
|
||||
- **FR3.2.4**: System must support meeting recordings
|
||||
- **FR3.2.5**: System must manage meeting access controls
|
||||
|
||||
### 3.4 Form Builder Module
|
||||
#### 3.4.1 Form Creation
|
||||
- **FR4.1.1**: System must support multi-stage form creation
|
||||
- **FR4.1.2**: System must provide various field types
|
||||
- **FR4.1.3**: System must support form validation rules
|
||||
- **FR4.1.4**: System must allow conditional logic
|
||||
- **FR4.1.5**: System must support form templates
|
||||
|
||||
#### 3.4.2 Form Processing
|
||||
- **FR4.2.1**: System must handle form submissions securely
|
||||
- **FR4.2.2**: System must support file uploads
|
||||
- **FR4.2.3**: System must extract data from submissions
|
||||
- **FR4.2.4**: System must create candidates from submissions
|
||||
- **FR4.2.5**: System must provide submission analytics
|
||||
|
||||
### 3.5 Reporting & Analytics Module
|
||||
#### 3.5.1 Dashboards
|
||||
- **FR5.1.1**: System must provide role-based dashboards
|
||||
- **FR5.1.2**: System must display key performance indicators
|
||||
- **FR5.1.3**: System must support real-time data updates
|
||||
- **FR5.1.4**: System must allow customization of dashboard views
|
||||
- **FR5.1.5**: System must support data visualization
|
||||
|
||||
#### 3.5.2 Reports
|
||||
- **FR5.2.1**: System must generate standard reports
|
||||
- **FR5.2.2**: System must support custom report generation
|
||||
- **FR5.2.3**: System must export data in multiple formats
|
||||
- **FR5.2.4**: System must schedule automated reports
|
||||
- **FR5.2.5**: System must support report distribution
|
||||
|
||||
## 4. Non-Functional Requirements
|
||||
|
||||
### 4.1 Performance Requirements
|
||||
- **NF1.1**: System must support concurrent users (100+)
|
||||
- **NF1.2**: Page load time must be under 3 seconds
|
||||
- **NF1.3**: API response time must be under 1 second
|
||||
- **NF1.4**: System must handle 10,000+ job postings
|
||||
- **NF1.5**: System must handle 100,000+ candidate records
|
||||
|
||||
### 4.2 Security Requirements
|
||||
- **NF2.1**: All data must be encrypted in transit and at rest
|
||||
- **NF2.2**: System must support role-based access control
|
||||
- **NF2.3**: System must maintain audit logs for all actions
|
||||
- **NF2.4**: System must comply with GDPR regulations
|
||||
- **NF2.5**: System must protect against common web vulnerabilities
|
||||
|
||||
### 4.3 Usability Requirements
|
||||
- **NF3.1**: Interface must be intuitive and easy to use
|
||||
- **NF3.2**: System must support both Arabic and English
|
||||
- **NF3.3**: System must be responsive and mobile-friendly
|
||||
- **NF3.4**: System must provide clear error messages
|
||||
- **NF3.5**: System must support keyboard navigation
|
||||
|
||||
### 4.4 Reliability Requirements
|
||||
- **NF4.1**: System must have 99.9% uptime
|
||||
- **NF4.2**: System must handle failures gracefully
|
||||
- **NF4.3**: System must support data backup and recovery
|
||||
- **NF4.4**: System must provide monitoring and alerts
|
||||
- **NF4.5**: System must support load balancing
|
||||
|
||||
### 4.5 Scalability Requirements
|
||||
- **NF5.1**: System must scale horizontally
|
||||
- **NF5.2**: System must handle peak loads
|
||||
- **NF5.3**: System must support database sharding
|
||||
- **NF5.4**: System must cache frequently accessed data
|
||||
- **NF5.5**: System must support microservices architecture
|
||||
|
||||
## 5. Integration Requirements
|
||||
|
||||
### 5.1 External Integrations
|
||||
- **INT1.1**: Zoom API for video conferencing
|
||||
- **INT1.2**: LinkedIn API for job posting and profiles
|
||||
- **INT1.3**: Email/SMS services for notifications
|
||||
- **INT1.4**: Calendar systems for scheduling
|
||||
- **INT1.5**: ERP systems for employee data
|
||||
|
||||
### 5.2 Internal Integrations
|
||||
- **INT2.1**: Single Sign-On (SSO) for authentication
|
||||
- **INT2.2**: File storage system for documents
|
||||
- **INT2.3**: Search engine for candidate matching
|
||||
- **INT2.4**: Analytics platform for reporting
|
||||
- **INT2.5**: Task queue for background processing
|
||||
|
||||
## 6. Business Rules
|
||||
|
||||
### 6.1 Job Posting Rules
|
||||
- **BR1.1**: Job postings must be approved before publishing
|
||||
- **BR1.2**: Application limits must be enforced per job
|
||||
- **BR1.3**: Job postings must have required fields completed
|
||||
- **BR1.4**: LinkedIn posts must follow platform guidelines
|
||||
- **BR1.5**: Job postings must comply with equal opportunity laws
|
||||
|
||||
### 6.2 Candidate Management Rules
|
||||
- **BR2.1**: Candidates can only progress to next stage with approval
|
||||
- **BR2.2**: Duplicate candidates must be prevented
|
||||
- **BR2.3**: Candidate data must be kept confidential
|
||||
- **BR2.4**: Communication must be tracked for all candidates
|
||||
- **BR2.5**: Background checks must be completed before offers
|
||||
|
||||
### 6.3 Interview Scheduling Rules
|
||||
- **BR3.1**: Interviews must be scheduled during business hours
|
||||
- **BR3.2**: Buffer time must be respected between interviews
|
||||
- **BR3.3**: Interviewers must be available for scheduled times
|
||||
- **BR3.4**: Cancellations must be handled according to policy
|
||||
- **BR3.5**: Feedback must be collected after each interview
|
||||
|
||||
### 6.4 Form Processing Rules
|
||||
- **BR4.1**: Required fields must be validated before submission
|
||||
- **BR4.2**: File uploads must be scanned for security
|
||||
- **BR4.3**: Form submissions must be processed in order
|
||||
- **BR4.4**: Duplicate submissions must be prevented
|
||||
- **BR4.5**: Form data must be extracted accurately
|
||||
|
||||
## 7. User Interface Requirements
|
||||
|
||||
### 7.1 Design Principles
|
||||
- **UI1.1**: Clean, modern interface with consistent branding
|
||||
- **UI1.2**: Intuitive navigation with clear hierarchy
|
||||
- **UI1.3**: Responsive design for all devices
|
||||
- **UI1.4**: Accessibility compliance (WCAG 2.1)
|
||||
- **UI1.5**: Fast loading with optimized performance
|
||||
|
||||
### 7.2 Key Screens
|
||||
- **UI2.1**: Dashboard with key metrics and quick actions
|
||||
- **UI2.2**: Job posting creation and management interface
|
||||
- **UI2.3**: Candidate pipeline with drag-and-drop stages
|
||||
- **UI2.4**: Interview scheduling calendar view
|
||||
- **UI2.5**: Form builder with drag-and-drop fields
|
||||
- **UI2.6**: Reports and analytics with interactive charts
|
||||
- **UI2.7**: Candidate profile with comprehensive information
|
||||
- **UI2.8**: Meeting interface with Zoom integration
|
||||
|
||||
### 7.3 Interaction Patterns
|
||||
- **UI3.1**: Consistent button styles and behaviors
|
||||
- **UI3.2**: Clear feedback for all user actions
|
||||
- **UI3.3**: Progressive disclosure for complex forms
|
||||
- **UI3.4**: Contextual help and tooltips
|
||||
- **UI3.5**: Keyboard shortcuts for power users
|
||||
|
||||
## 8. Data Management
|
||||
|
||||
### 8.1 Data Storage
|
||||
- **DM1.1**: All data must be stored securely
|
||||
- **DM1.2**: Sensitive data must be encrypted
|
||||
- **DM1.3**: Data must be backed up regularly
|
||||
- **DM1.4**: Data retention policies must be enforced
|
||||
- **DM1.5**: Data must be accessible for reporting
|
||||
|
||||
### 8.2 Data Migration
|
||||
- **DM2.1**: Support import from legacy systems
|
||||
- **DM2.2**: Provide data validation during migration
|
||||
- **DM2.3**: Support incremental data updates
|
||||
- **DM2.4**: Maintain data integrity during migration
|
||||
- **DM2.5**: Provide rollback capabilities
|
||||
|
||||
### 8.3 Data Quality
|
||||
- **DM3.1**: Implement data validation rules
|
||||
- **DM3.2**: Provide data cleansing tools
|
||||
- **DM3.3**: Monitor data quality metrics
|
||||
- **DM3.4**: Handle duplicate data detection
|
||||
- **DM3.5**: Support data standardization
|
||||
|
||||
## 9. Implementation Plan
|
||||
|
||||
### 9.1 Development Phases
|
||||
#### Phase 1: Core Functionality (Months 1-3)
|
||||
- User authentication and authorization
|
||||
- Basic job posting and management
|
||||
- Candidate database and pipeline
|
||||
- Basic reporting dashboards
|
||||
- Form builder with essential fields
|
||||
|
||||
#### Phase 2: Enhanced Features (Months 4-6)
|
||||
- Interview scheduling and Zoom integration
|
||||
- LinkedIn integration for job posting
|
||||
- Advanced reporting and analytics
|
||||
- Candidate matching and scoring
|
||||
- Mobile-responsive design
|
||||
|
||||
#### Phase 3: Advanced Features (Months 7-9)
|
||||
- AI-powered candidate matching
|
||||
- Advanced form builder with conditions
|
||||
- Integration with external systems
|
||||
- Performance optimization
|
||||
- Security hardening
|
||||
|
||||
#### Phase 4: Production Readiness (Months 10-12)
|
||||
- Load testing and performance optimization
|
||||
- Security audit and compliance
|
||||
- Documentation and training materials
|
||||
- Beta testing with real users
|
||||
- Production deployment
|
||||
|
||||
### 9.2 Team Structure
|
||||
- **Project Manager**: Overall project coordination
|
||||
- **Product Owner**: Requirements and backlog management
|
||||
- **UI/UX Designer**: Interface design and user experience
|
||||
- **Backend Developers**: Server-side development
|
||||
- **Frontend Developers**: Client-side development
|
||||
- **QA Engineers**: Testing and quality assurance
|
||||
- **DevOps Engineers**: Deployment and infrastructure
|
||||
- **Business Analyst**: Requirements gathering and analysis
|
||||
|
||||
### 9.3 Technology Stack
|
||||
- **Frontend**: HTML5, CSS3, JavaScript, Bootstrap 5, HTMX
|
||||
- **Backend**: Django 5.2.1, Python 3.11
|
||||
- **Database**: PostgreSQL (production), SQLite (development)
|
||||
- **APIs**: Django REST Framework
|
||||
- **Authentication**: Django Allauth, OAuth 2.0
|
||||
- **Real-time**: HTMX, WebSocket
|
||||
- **Task Queue**: Celery with Redis
|
||||
- **Storage**: Local filesystem, AWS S3
|
||||
- **Monitoring**: Prometheus, Grafana
|
||||
- **CI/CD**: Docker, Kubernetes
|
||||
|
||||
## 10. Success Metrics
|
||||
|
||||
### 10.1 Business Metrics
|
||||
- **BM1.1**: Reduce time-to-hire by 30%
|
||||
- **BM1.2**: Improve candidate quality by 25%
|
||||
- **BM1.3**: Increase recruiter efficiency by 40%
|
||||
- **BM1.4**: Reduce recruitment costs by 20%
|
||||
- **BM1.5**: Improve candidate satisfaction by 35%
|
||||
|
||||
### 10.2 Technical Metrics
|
||||
- **TM1.1**: System uptime of 99.9%
|
||||
- **TM1.2**: Page load time under 3 seconds
|
||||
- **TM1.3**: API response time under 1 second
|
||||
- **TM1.4**: 0 critical security vulnerabilities
|
||||
- **TM1.5**: 95% test coverage
|
||||
|
||||
### 10.3 User Adoption Metrics
|
||||
- **UM1.1**: 90% of target users actively using the system
|
||||
- **UM1.2**: 80% reduction in manual processes
|
||||
- **UM1.3**: 75% improvement in user satisfaction
|
||||
- **UM1.4**: 50% reduction in recruitment time
|
||||
- **UM1.5**: 95% data accuracy in the system
|
||||
|
||||
## 11. Risk Assessment
|
||||
|
||||
### 11.1 Technical Risks
|
||||
- **TR1.1**: Integration complexity with external systems
|
||||
- **TR1.2**: Performance issues with large datasets
|
||||
- **TR1.3**: Security vulnerabilities in third-party APIs
|
||||
- **TR1.4**: Data migration challenges
|
||||
- **TR1.5**: Scalability concerns
|
||||
|
||||
### 11.2 Business Risks
|
||||
- **BR1.1**: User resistance to new system
|
||||
- **BR1.2**: Changes in recruitment processes
|
||||
- **BR1.3**: Budget constraints
|
||||
- **BR1.4**: Timeline delays
|
||||
- **BR1.5**: Regulatory changes
|
||||
|
||||
### 11.3 Mitigation Strategies
|
||||
- **MS1.1**: Phased implementation with user feedback
|
||||
- **MS1.2**: Regular performance testing and optimization
|
||||
- **MS1.3**: Security audits and penetration testing
|
||||
- **MS1.4**: Comprehensive training and support
|
||||
- **MS1.5**: Flexible architecture for future changes
|
||||
|
||||
## 12. Training & Support
|
||||
|
||||
### 12.1 User Training
|
||||
- **TU1.1**: Role-based training programs
|
||||
- **TU1.2**: Online documentation and help guides
|
||||
- **TU1.3**: Video tutorials for key features
|
||||
- **TU1.4**: In-person training sessions
|
||||
- **TU1.5**: Refresher courses and updates
|
||||
|
||||
### 12.2 Technical Support
|
||||
- **TS1.1**: Helpdesk with dedicated support staff
|
||||
- **TS1.2**: Online ticketing system
|
||||
- **TS1.3**: Remote support capabilities
|
||||
- **TS1.4**: Knowledge base and FAQs
|
||||
- **TS1.5**: 24/7 support for critical issues
|
||||
|
||||
### 12.3 System Maintenance
|
||||
- **SM1.1**: Regular system updates and patches
|
||||
- **SM1.2**: Performance monitoring and optimization
|
||||
- **SM1.3**: Data backup and recovery procedures
|
||||
- **SM1.4**: System health checks
|
||||
- **SM1.5**: Continuous improvement based on feedback
|
||||
|
||||
---
|
||||
|
||||
*Document Version: 1.0*
|
||||
*Last Updated: October 17, 2025*
|
||||
241
ATS_PROJECT_HLD.md
Normal file
241
ATS_PROJECT_HLD.md
Normal file
@ -0,0 +1,241 @@
|
||||
# KAAUH Applicant Tracking System (ATS) - High Level Design Document
|
||||
|
||||
## 1. Executive Summary
|
||||
|
||||
This document outlines the High-Level Design (HLD) for the King Abdulaziz University Hospital (KAAUH) Applicant Tracking System (ATS). The system is designed to streamline the recruitment process by providing comprehensive tools for job posting, candidate management, interview scheduling, and integration with external platforms.
|
||||
|
||||
## 2. System Overview
|
||||
|
||||
### 2.1 Vision
|
||||
To create a modern, efficient, and user-friendly recruitment management system that automates and optimizes the hiring process at KAAUH.
|
||||
|
||||
### 2.2 Mission
|
||||
The ATS aims to:
|
||||
- Centralize recruitment activities
|
||||
- Improve candidate experience
|
||||
- Enhance recruiter efficiency
|
||||
- Provide data-driven insights
|
||||
- Integrate with external platforms (Zoom, LinkedIn, ERP)
|
||||
|
||||
### 2.3 Goals
|
||||
- Reduce time-to-hire
|
||||
- Improve candidate quality
|
||||
- Enhance reporting and analytics
|
||||
- Provide seamless user experience
|
||||
- Ensure system scalability and maintainability
|
||||
|
||||
## 3. Architecture Overview
|
||||
|
||||
### 3.1 Technology Stack
|
||||
- **Backend**: Django 5.2.1 (Python)
|
||||
- **Frontend**: HTML5, CSS3, JavaScript, Bootstrap 5
|
||||
- **Database**: SQLite (development), PostgreSQL (production)
|
||||
- **APIs**: REST API with Django REST Framework
|
||||
- **Real-time**: HTMX for dynamic UI updates
|
||||
- **Authentication**: Django Allauth with OAuth (LinkedIn)
|
||||
- **File Storage**: Local filesystem
|
||||
- **Task Queue**: Celery with Redis
|
||||
- **Communication**: Email, Webhooks (Zoom)
|
||||
|
||||
### 3.2 System Architecture
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ Web Browser │ │ Mobile App │ │ Admin Panel │
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
│ │ │
|
||||
└───────────────────────┼───────────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ Load Balancer │
|
||||
└─────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ Web Server │
|
||||
│ (Gunicorn) │
|
||||
└─────────────────┘
|
||||
│
|
||||
┌─────────────────┐
|
||||
│ Application │
|
||||
│ (Django) │
|
||||
└─────────────────┘
|
||||
│ │
|
||||
┌───────────────┴─────────┐ ┌─────┴────────────────┐
|
||||
│ Database Layer │ │ External Services│
|
||||
│ (SQLite/PostgreSQL) │ │ (Zoom, LinkedIn) │
|
||||
└─────────────────────────┘ └─────────────────────┘
|
||||
```
|
||||
|
||||
## 4. Core Components
|
||||
|
||||
### 4.1 User Management
|
||||
- **Role-based Access Control**:
|
||||
- System Administrators
|
||||
- Hiring Managers
|
||||
- Recruiters
|
||||
- Interviewers
|
||||
- Candidates
|
||||
- **Authentication**:
|
||||
- User registration and login
|
||||
- LinkedIn OAuth integration
|
||||
- Session management
|
||||
|
||||
### 4.2 Job Management
|
||||
- **Job Posting**:
|
||||
- Create, edit, delete job postings
|
||||
- Job templates and cloning
|
||||
- Multi-language support
|
||||
- Approval workflows
|
||||
- **Job Distribution**:
|
||||
- LinkedIn integration
|
||||
- Career page management
|
||||
- Application tracking
|
||||
|
||||
### 4.3 Candidate Management
|
||||
- **Candidate Database**:
|
||||
- Profile management
|
||||
- Resume parsing and storage
|
||||
- Skills assessment
|
||||
- Candidate scoring
|
||||
- **Candidate Tracking**:
|
||||
- Application status tracking
|
||||
- Stage transitions
|
||||
- Communication logging
|
||||
- Candidate relationship management
|
||||
|
||||
### 4.4 Interview Management
|
||||
- **Scheduling**:
|
||||
- Automated interview scheduling
|
||||
- Calendar integration
|
||||
- Time slot management
|
||||
- Buffer time configuration
|
||||
- **Video Interviews**:
|
||||
- Zoom API integration
|
||||
- Meeting creation and management
|
||||
- Recording and playback
|
||||
- Interview feedback collection
|
||||
|
||||
### 4.5 Form Builder
|
||||
- **Dynamic Forms**:
|
||||
- Multi-stage form creation
|
||||
- Custom field types
|
||||
- Validation rules
|
||||
- File upload support
|
||||
- **Application Processing**:
|
||||
- Form submission handling
|
||||
- Data extraction and storage
|
||||
- Notification systems
|
||||
|
||||
### 4.6 Reporting and Analytics
|
||||
- **Dashboards**:
|
||||
- Executive dashboard
|
||||
- Recruitment metrics
|
||||
- Candidate analytics
|
||||
- Department-specific reports
|
||||
- **Data Export**:
|
||||
- CSV, Excel, PDF exports
|
||||
- Custom report generation
|
||||
- Scheduled reports
|
||||
|
||||
## 5. Integration Architecture
|
||||
|
||||
### 5.1 External API Integrations
|
||||
- **Zoom Video Conferencing**:
|
||||
- Meeting creation and management
|
||||
- Webhook event handling
|
||||
- Recording and transcription
|
||||
- **LinkedIn Recruitment**:
|
||||
- Job posting automation
|
||||
- Profile synchronization
|
||||
- Analytics tracking
|
||||
- **ERP Systems**:
|
||||
- Employee data synchronization
|
||||
- Position management
|
||||
- Financial integration
|
||||
|
||||
### 5.2 Internal Integrations
|
||||
- **Email System**:
|
||||
- Automated notifications
|
||||
- Interview reminders
|
||||
- Status updates
|
||||
- **Calendar System**:
|
||||
- Interview scheduling
|
||||
- Availability management
|
||||
- Conflict detection
|
||||
|
||||
## 6. Security Architecture
|
||||
|
||||
### 6.1 Authentication & Authorization
|
||||
- Multi-factor authentication support
|
||||
- Role-based access control
|
||||
- JWT token authentication
|
||||
- OAuth 2.0 integration
|
||||
|
||||
### 6.2 Data Protection
|
||||
- Data encryption at rest and in transit
|
||||
- Secure file storage
|
||||
- Personal data protection
|
||||
- Audit logging
|
||||
|
||||
### 6.3 System Security
|
||||
- Input validation and sanitization
|
||||
- SQL injection prevention
|
||||
- XSS protection
|
||||
- CSRF protection
|
||||
- Rate limiting
|
||||
|
||||
## 7. Scalability & Performance
|
||||
|
||||
### 7.1 Performance Optimization
|
||||
- Database indexing
|
||||
- Query optimization
|
||||
- Caching strategies (Redis)
|
||||
- Asynchronous task processing (Celery)
|
||||
|
||||
### 7.2 Scalability Considerations
|
||||
- Horizontal scaling support
|
||||
- Load balancing
|
||||
- Database replication
|
||||
- Microservices-ready architecture
|
||||
|
||||
## 8. Deployment & Operations
|
||||
|
||||
### 8.1 Deployment Strategy
|
||||
- Container-based deployment (Docker)
|
||||
- Environment management
|
||||
- CI/CD pipeline
|
||||
- Automated testing
|
||||
|
||||
### 8.2 Monitoring & Maintenance
|
||||
- Application monitoring
|
||||
- Performance metrics
|
||||
- Error tracking
|
||||
- Automated backups
|
||||
|
||||
## 9. Future Roadmap
|
||||
|
||||
### 9.1 Phase 1 (Current)
|
||||
- Core ATS functionality
|
||||
- Basic reporting
|
||||
- Zoom and LinkedIn integration
|
||||
- Mobile-responsive design
|
||||
|
||||
### 9.2 Phase 2 (Next 6 months)
|
||||
- Advanced analytics
|
||||
- AI-powered candidate matching
|
||||
- Enhanced reporting
|
||||
- Mobile app development
|
||||
|
||||
### 9.3 Phase 3 (Next 12 months)
|
||||
- Voice interview support
|
||||
- Video interview AI analysis
|
||||
- Advanced integrations
|
||||
- Multi-tenant support
|
||||
|
||||
## 10. Conclusion
|
||||
|
||||
The KAAUH ATS system is designed to be a comprehensive, modern, and scalable solution for managing the recruitment lifecycle. By leveraging Django's robust framework and integrating with external platforms, the system will significantly improve recruitment efficiency and provide valuable insights for decision-making.
|
||||
|
||||
---
|
||||
|
||||
*Document Version: 1.0*
|
||||
*Last Updated: October 17, 2025*
|
||||
1083
ATS_PROJECT_LLD.md
Normal file
1083
ATS_PROJECT_LLD.md
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -59,7 +59,6 @@ INSTALLED_APPS = [
|
||||
'django_q',
|
||||
'widget_tweaks',
|
||||
'easyaudit'
|
||||
|
||||
]
|
||||
|
||||
|
||||
@ -67,13 +66,13 @@ INSTALLED_APPS = [
|
||||
SITE_ID = 1
|
||||
|
||||
|
||||
LOGIN_REDIRECT_URL = '/dashboard/'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
|
||||
|
||||
ACCOUNT_LOGOUT_REDIRECT_URL = '/'
|
||||
|
||||
|
||||
ACCOUNT_SIGNUP_REDIRECT_URL = '/dashboard/'
|
||||
ACCOUNT_SIGNUP_REDIRECT_URL = '/'
|
||||
|
||||
|
||||
LOGIN_URL = '/accounts/login/'
|
||||
@ -135,11 +134,14 @@ WSGI_APPLICATION = 'NorahUniversity.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'norahuniversity',
|
||||
'USER': 'norahuniversity',
|
||||
'PASSWORD': 'norahuniversity',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '5432',
|
||||
}
|
||||
}
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
|
||||
|
||||
@ -249,6 +251,7 @@ Q_CLUSTER = {
|
||||
'workers': 8,
|
||||
'recycle': 500,
|
||||
'timeout': 60,
|
||||
'max_attempts': 1,
|
||||
'compress': True,
|
||||
'save_limit': 250,
|
||||
'queue_limit': 500,
|
||||
@ -257,7 +260,7 @@ Q_CLUSTER = {
|
||||
'redis': {
|
||||
'host': '127.0.0.1',
|
||||
'port': 6379,
|
||||
'db': 0, },
|
||||
'db': 3, },
|
||||
'ALT_CLUSTERS': {
|
||||
'long': {
|
||||
'timeout': 3000,
|
||||
@ -369,4 +372,4 @@ CKEDITOR_5_CONFIGS = {
|
||||
}
|
||||
|
||||
# Define a constant in settings.py to specify file upload permissions
|
||||
CKEDITOR_5_FILE_UPLOAD_PERMISSION = "staff" # Possible values: "staff", "authenticated", "any"
|
||||
CKEDITOR_5_FILE_UPLOAD_PERMISSION = "staff" # Possible values: "staff", "authenticated", "any"
|
||||
|
||||
312
TESTING_GUIDE.md
Normal file
312
TESTING_GUIDE.md
Normal file
@ -0,0 +1,312 @@
|
||||
# Recruitment Application Testing Guide
|
||||
|
||||
This guide provides comprehensive information about testing the Recruitment Application (ATS) system.
|
||||
|
||||
## Test Structure
|
||||
|
||||
The test suite is organized into several modules:
|
||||
|
||||
### 1. Basic Tests (`recruitment/tests.py`)
|
||||
- **BaseTestCase**: Common setup for all tests
|
||||
- **ModelTests**: Basic model functionality tests
|
||||
- **ViewTests**: Standard view tests
|
||||
- **FormTests**: Basic form validation tests
|
||||
- **IntegrationTests**: Simple integration scenarios
|
||||
|
||||
### 2. Advanced Tests (`recruitment/tests_advanced.py`)
|
||||
- **AdvancedModelTests**: Complex model scenarios and edge cases
|
||||
- **AdvancedViewTests**: Complex view logic with multiple filters and workflows
|
||||
- **AdvancedFormTests**: Complex form validation and dynamic fields
|
||||
- **AdvancedIntegrationTests**: End-to-end workflows and concurrent operations
|
||||
- **SecurityTests**: Security-focused testing
|
||||
|
||||
### 3. Configuration Files
|
||||
- **`pytest.ini`**: Pytest configuration with coverage settings
|
||||
- **`conftest.py`**: Pytest fixtures and common test setup
|
||||
|
||||
## Running Tests
|
||||
|
||||
### Basic Test Execution
|
||||
```bash
|
||||
# Run all tests
|
||||
python manage.py test recruitment
|
||||
|
||||
# Run specific test class
|
||||
python manage.py test recruitment.tests.AdvancedModelTests
|
||||
|
||||
# Run with verbose output
|
||||
python manage.py test recruitment --verbosity=2
|
||||
|
||||
# Run tests with coverage
|
||||
python manage.py test recruitment --coverage
|
||||
```
|
||||
|
||||
### Using Pytest
|
||||
```bash
|
||||
# Install pytest and required packages
|
||||
pip install pytest pytest-django pytest-cov
|
||||
|
||||
# Run all tests
|
||||
pytest
|
||||
|
||||
# Run specific test file
|
||||
pytest recruitment/tests.py
|
||||
|
||||
# Run with coverage
|
||||
pytest --cov=recruitment --cov-report=html
|
||||
|
||||
# Run with markers
|
||||
pytest -m unit # Run only unit tests
|
||||
pytest -m integration # Run only integration tests
|
||||
pytest -m "not slow" # Skip slow tests
|
||||
```
|
||||
|
||||
### Test Markers
|
||||
- `@pytest.mark.unit`: For unit tests
|
||||
- `@pytest.mark.integration`: For integration tests
|
||||
- `@pytest.mark.security`: For security tests
|
||||
- `@pytest.mark.api`: For API tests
|
||||
- `@pytest.mark.slow`: For performance-intensive tests
|
||||
|
||||
## Test Coverage
|
||||
|
||||
The test suite aims for 80% code coverage. Coverage reports are generated in:
|
||||
- HTML: `htmlcov/index.html`
|
||||
- Terminal: Shows missing lines
|
||||
|
||||
### Improving Coverage
|
||||
1. Add tests for untested branches
|
||||
2. Test error conditions and edge cases
|
||||
3. Use mocking for external dependencies
|
||||
|
||||
## Key Testing Areas
|
||||
|
||||
### 1. Model Testing
|
||||
- **JobPosting**: ID generation, validation, methods
|
||||
- **Candidate**: Stage transitions, relationships
|
||||
- **ZoomMeeting**: Time validation, status handling
|
||||
- **FormTemplate**: Template integrity, field ordering
|
||||
- **InterviewSchedule**: Scheduling logic, slot generation
|
||||
|
||||
### 2. View Testing
|
||||
- **Job Management**: CRUD operations, search, filtering
|
||||
- **Candidate Management**: Stage updates, bulk operations
|
||||
- **Meeting Management**: Scheduling, API integration
|
||||
- **Form Handling**: Submission processing, validation
|
||||
|
||||
### 3. Form Testing
|
||||
- **JobPostingForm**: Complex validation, field dependencies
|
||||
- **CandidateForm**: File upload, validation
|
||||
- **InterviewScheduleForm**: Dynamic fields, validation
|
||||
- **MeetingCommentForm**: Comment creation/editing
|
||||
|
||||
### 4. Integration Testing
|
||||
- **Complete Hiring Workflow**: Job → Application → Interview → Hire
|
||||
- **Data Integrity**: Cross-component data consistency
|
||||
- **API Integration**: Zoom API, LinkedIn integration
|
||||
- **Concurrent Operations**: Multi-threading scenarios
|
||||
|
||||
### 5. Security Testing
|
||||
- **Access Control**: Permission validation
|
||||
- **CSRF Protection**: Form security
|
||||
- **Input Validation**: SQL injection, XSS prevention
|
||||
- **Authentication**: User authorization
|
||||
|
||||
## Test Fixtures
|
||||
|
||||
Common fixtures available in `conftest.py`:
|
||||
|
||||
- **User Fixtures**: `user`, `staff_user`, `profile`
|
||||
- **Model Fixtures**: `job`, `candidate`, `zoom_meeting`, `form_template`
|
||||
- **Form Data Fixtures**: `job_form_data`, `candidate_form_data`
|
||||
- **Mock Fixtures**: `mock_zoom_api`, `mock_time_slots`
|
||||
- **Client Fixtures**: `client`, `authenticated_client`, `authenticated_staff_client`
|
||||
|
||||
## Writing New Tests
|
||||
|
||||
### Test Naming Convention
|
||||
- Use descriptive names: `test_user_can_create_job_posting`
|
||||
- Follow the pattern: `test_[subject]_[action]_[expected_result]`
|
||||
|
||||
### Best Practices
|
||||
1. **Use Fixtures**: Leverage existing fixtures instead of creating test data
|
||||
2. **Mock External Dependencies**: Use `@patch` for API calls
|
||||
3. **Test Edge Cases**: Include invalid data, boundary conditions
|
||||
4. **Maintain Independence**: Each test should be runnable independently
|
||||
5. **Use Assertions**: Be specific about expected outcomes
|
||||
|
||||
### Example Test Structure
|
||||
```python
|
||||
from django.test import TestCase
|
||||
from recruitment.models import JobPosting
|
||||
from recruitment.tests import BaseTestCase
|
||||
|
||||
class JobPostingTests(BaseTestCase):
|
||||
|
||||
def test_job_creation_minimal_data(self):
|
||||
"""Test job creation with minimal required fields"""
|
||||
job = JobPosting.objects.create(
|
||||
title='Minimal Job',
|
||||
department='IT',
|
||||
job_type='FULL_TIME',
|
||||
workplace_type='REMOTE',
|
||||
created_by=self.user
|
||||
)
|
||||
self.assertEqual(job.title, 'Minimal Job')
|
||||
self.assertIsNotNone(job.slug)
|
||||
|
||||
def test_job_posting_validation_invalid_data(self):
|
||||
"""Test that invalid data raises validation errors"""
|
||||
with self.assertRaises(ValueError):
|
||||
JobPosting.objects.create(
|
||||
title='', # Empty title
|
||||
department='IT',
|
||||
job_type='FULL_TIME',
|
||||
workplace_type='REMOTE',
|
||||
created_by=self.user
|
||||
)
|
||||
```
|
||||
|
||||
## Testing External Integrations
|
||||
|
||||
### Zoom API Integration
|
||||
```python
|
||||
@patch('recruitment.views.create_zoom_meeting')
|
||||
def test_meeting_creation(self, mock_zoom):
|
||||
"""Test Zoom meeting creation with mocked API"""
|
||||
mock_zoom.return_value = {
|
||||
'status': 'success',
|
||||
'meeting_details': {
|
||||
'meeting_id': '123456789',
|
||||
'join_url': 'https://zoom.us/j/123456789'
|
||||
}
|
||||
}
|
||||
|
||||
# Test meeting creation logic
|
||||
result = create_zoom_meeting('Test Meeting', start_time, duration)
|
||||
self.assertEqual(result['status'], 'success')
|
||||
mock_zoom.assert_called_once()
|
||||
```
|
||||
|
||||
### LinkedIn Integration
|
||||
```python
|
||||
@patch('recruitment.views.LinkedinService')
|
||||
def test_linkedin_posting(self, mock_linkedin):
|
||||
"""Test LinkedIn job posting with mocked service"""
|
||||
mock_service = mock_linkedin.return_value
|
||||
mock_service.create_job_post.return_value = {
|
||||
'success': True,
|
||||
'post_id': 'linkedin123',
|
||||
'post_url': 'https://linkedin.com/jobs/view/linkedin123'
|
||||
}
|
||||
|
||||
# Test LinkedIn posting logic
|
||||
result = mock_service.create_job_post(job)
|
||||
self.assertTrue(result['success'])
|
||||
```
|
||||
|
||||
## Performance Testing
|
||||
|
||||
### Running Performance Tests
|
||||
```bash
|
||||
# Run slow tests only
|
||||
pytest -m slow
|
||||
|
||||
# Profile test execution
|
||||
pytest --profile
|
||||
```
|
||||
|
||||
### Performance Considerations
|
||||
1. Use `TransactionTestCase` for tests that require database commits
|
||||
2. Mock external API calls to avoid network delays
|
||||
3. Use `select_related` and `prefetch_related` in queries
|
||||
4. Test with realistic data volumes
|
||||
|
||||
## Continuous Integration
|
||||
|
||||
### GitHub Actions Integration
|
||||
```yaml
|
||||
name: Tests
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.9, 3.10, 3.11]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install pytest pytest-django pytest-cov
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest --cov=recruitment --cov-report=xml
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
```
|
||||
|
||||
## Troubleshooting Common Issues
|
||||
|
||||
### Database Issues
|
||||
```python
|
||||
# Use TransactionTestCase for tests that modify database structure
|
||||
from django.test import TransactionTestCase
|
||||
|
||||
class MyTests(TransactionTestCase):
|
||||
def test_database_modification(self):
|
||||
# This test will properly clean up the database
|
||||
pass
|
||||
```
|
||||
|
||||
### Mocking Issues
|
||||
```python
|
||||
# Correct way to mock imports
|
||||
from unittest.mock import patch
|
||||
|
||||
@patch('recruitment.views.zoom_api.ZoomClient')
|
||||
def test_zoom_integration(self, mock_zoom_client):
|
||||
mock_instance = mock_zoom_client.return_value
|
||||
mock_instance.create_meeting.return_value = {'success': True}
|
||||
|
||||
# Test code
|
||||
```
|
||||
|
||||
### HTMX Testing
|
||||
```python
|
||||
# Test HTMX responses
|
||||
def test_htmx_partial_update(self):
|
||||
response = self.client.get('/some-url/', HTTP_HX_REQUEST='true')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn('partial-content', response.content)
|
||||
```
|
||||
|
||||
## Contributing to Tests
|
||||
|
||||
### Adding New Tests
|
||||
1. Place tests in appropriate test modules
|
||||
2. Use existing fixtures when possible
|
||||
3. Add descriptive docstrings
|
||||
4. Mark tests with appropriate markers
|
||||
5. Ensure new tests maintain coverage requirements
|
||||
|
||||
### Test Review Checklist
|
||||
- [ ] Tests are properly isolated
|
||||
- [ ] Fixtures are used effectively
|
||||
- [ ] External dependencies are mocked
|
||||
- [ ] Edge cases are covered
|
||||
- [ ] Naming conventions are followed
|
||||
- [ ] Documentation is clear
|
||||
|
||||
## Resources
|
||||
|
||||
- [Django Testing Documentation](https://docs.djangoproject.com/en/stable/topics/testing/)
|
||||
- [Pytest Documentation](https://docs.pytest.org/)
|
||||
- [Test-Driven Development](https://testdriven.io/blog/tdd-with-django-and-react/)
|
||||
- [Code Coverage Best Practices](https://pytest-cov.readthedocs.io/)
|
||||
394
conftest.py
Normal file
394
conftest.py
Normal file
@ -0,0 +1,394 @@
|
||||
"""
|
||||
Pytest configuration and fixtures for the recruitment application tests.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import django
|
||||
from pathlib import Path
|
||||
|
||||
# Setup Django
|
||||
BASE_DIR = Path(__file__).resolve().parent
|
||||
|
||||
# Add the project root to sys.path
|
||||
sys.path.append(str(BASE_DIR))
|
||||
|
||||
# Set the Django settings module
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NorahUniversity.settings')
|
||||
|
||||
# Configure Django
|
||||
django.setup()
|
||||
|
||||
import pytest
|
||||
from django.test import TestCase
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.utils import timezone
|
||||
from datetime import datetime, time, timedelta, date
|
||||
|
||||
from recruitment.models import (
|
||||
JobPosting, Candidate, ZoomMeeting, FormTemplate, FormStage, FormField,
|
||||
FormSubmission, FieldResponse, InterviewSchedule, ScheduledInterview,
|
||||
TrainingMaterial, Source, HiringAgency, Profile, MeetingComment, JobPostingImage,
|
||||
BreakTime
|
||||
)
|
||||
from recruitment.forms import (
|
||||
JobPostingForm, CandidateForm, ZoomMeetingForm, MeetingCommentForm,
|
||||
CandidateStageForm, InterviewScheduleForm, BreakTimeFormSet
|
||||
)
|
||||
|
||||
|
||||
# Removed: django_db_setup fixture conflicts with Django TestCase
|
||||
# Django TestCase handles its own database setup
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user():
|
||||
"""Create a regular user for testing"""
|
||||
return User.objects.create_user(
|
||||
username='testuser',
|
||||
email='test@example.com',
|
||||
password='testpass123',
|
||||
is_staff=False
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def staff_user():
|
||||
"""Create a staff user for testing"""
|
||||
return User.objects.create_user(
|
||||
username='staffuser',
|
||||
email='staff@example.com',
|
||||
password='testpass123',
|
||||
is_staff=True
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def profile(user):
|
||||
"""Create a user profile"""
|
||||
return Profile.objects.create(user=user)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job(staff_user):
|
||||
"""Create a job posting for testing"""
|
||||
return JobPosting.objects.create(
|
||||
title='Software Engineer',
|
||||
department='IT',
|
||||
job_type='FULL_TIME',
|
||||
workplace_type='REMOTE',
|
||||
location_country='Saudi Arabia',
|
||||
description='Job description',
|
||||
qualifications='Job qualifications',
|
||||
created_by=staff_user,
|
||||
status='ACTIVE',
|
||||
max_applications=100,
|
||||
open_positions=1
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def candidate(job):
|
||||
"""Create a candidate for testing"""
|
||||
return Candidate.objects.create(
|
||||
first_name='John',
|
||||
last_name='Doe',
|
||||
email='john@example.com',
|
||||
phone='1234567890',
|
||||
job=job,
|
||||
stage='Applied'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def zoom_meeting():
|
||||
"""Create a Zoom meeting for testing"""
|
||||
return ZoomMeeting.objects.create(
|
||||
topic='Interview with John Doe',
|
||||
start_time=timezone.now() + timedelta(hours=1),
|
||||
duration=60,
|
||||
timezone='UTC',
|
||||
join_url='https://zoom.us/j/123456789',
|
||||
meeting_id='123456789',
|
||||
status='waiting'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def form_template(staff_user, job):
|
||||
"""Create a form template for testing"""
|
||||
return FormTemplate.objects.create(
|
||||
job=job,
|
||||
name='Test Application Form',
|
||||
description='Test form template',
|
||||
created_by=staff_user,
|
||||
is_active=True
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def form_stage(form_template):
|
||||
"""Create a form stage for testing"""
|
||||
return FormStage.objects.create(
|
||||
template=form_template,
|
||||
name='Personal Information',
|
||||
order=0
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def form_field(form_stage):
|
||||
"""Create a form field for testing"""
|
||||
return FormField.objects.create(
|
||||
stage=form_stage,
|
||||
label='First Name',
|
||||
field_type='text',
|
||||
order=0,
|
||||
required=True
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def form_submission(form_template):
|
||||
"""Create a form submission for testing"""
|
||||
return FormSubmission.objects.create(
|
||||
template=form_template,
|
||||
applicant_name='John Doe',
|
||||
applicant_email='john@example.com'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def field_response(form_submission, form_field):
|
||||
"""Create a field response for testing"""
|
||||
return FieldResponse.objects.create(
|
||||
submission=form_submission,
|
||||
field=form_field,
|
||||
value='John'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def interview_schedule(staff_user, job):
|
||||
"""Create an interview schedule for testing"""
|
||||
# Create candidates first
|
||||
candidates = []
|
||||
for i in range(3):
|
||||
candidate = Candidate.objects.create(
|
||||
first_name=f'Candidate{i}',
|
||||
last_name=f'Test{i}',
|
||||
email=f'candidate{i}@example.com',
|
||||
phone=f'12345678{i}',
|
||||
job=job,
|
||||
stage='Interview'
|
||||
)
|
||||
candidates.append(candidate)
|
||||
|
||||
return InterviewSchedule.objects.create(
|
||||
job=job,
|
||||
created_by=staff_user,
|
||||
start_date=date.today() + timedelta(days=1),
|
||||
end_date=date.today() + timedelta(days=7),
|
||||
working_days=[0, 1, 2, 3, 4], # Mon-Fri
|
||||
start_time=time(9, 0),
|
||||
end_time=time(17, 0),
|
||||
interview_duration=60,
|
||||
buffer_time=15,
|
||||
break_start_time=time(12, 0),
|
||||
break_end_time=time(13, 0)
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scheduled_interview(candidate, job, zoom_meeting):
|
||||
"""Create a scheduled interview for testing"""
|
||||
return ScheduledInterview.objects.create(
|
||||
candidate=candidate,
|
||||
job=job,
|
||||
zoom_meeting=zoom_meeting,
|
||||
interview_date=timezone.now().date(),
|
||||
interview_time=time(10, 0),
|
||||
status='scheduled'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def meeting_comment(user, zoom_meeting):
|
||||
"""Create a meeting comment for testing"""
|
||||
return MeetingComment.objects.create(
|
||||
meeting=zoom_meeting,
|
||||
author=user,
|
||||
content='This is a test comment'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def file_content():
|
||||
"""Create test file content"""
|
||||
return b'%PDF-1.4\n% ... test content ...'
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def uploaded_file(file_content):
|
||||
"""Create an uploaded file for testing"""
|
||||
return SimpleUploadedFile(
|
||||
'test_file.pdf',
|
||||
file_content,
|
||||
content_type='application/pdf'
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job_form_data():
|
||||
"""Basic job posting form data for testing"""
|
||||
return {
|
||||
'title': 'Test Job Title',
|
||||
'department': 'IT',
|
||||
'job_type': 'FULL_TIME',
|
||||
'workplace_type': 'REMOTE',
|
||||
'location_city': 'Riyadh',
|
||||
'location_state': 'Riyadh',
|
||||
'location_country': 'Saudi Arabia',
|
||||
'description': 'Job description',
|
||||
'qualifications': 'Job qualifications',
|
||||
'salary_range': '5000-7000',
|
||||
'application_deadline': '2025-12-31',
|
||||
'max_applications': '100',
|
||||
'open_positions': '1',
|
||||
'hash_tags': '#hiring, #jobopening'
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def candidate_form_data(job):
|
||||
"""Basic candidate form data for testing"""
|
||||
return {
|
||||
'job': job.id,
|
||||
'first_name': 'John',
|
||||
'last_name': 'Doe',
|
||||
'phone': '1234567890',
|
||||
'email': 'john@example.com'
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def zoom_meeting_form_data():
|
||||
"""Basic Zoom meeting form data for testing"""
|
||||
start_time = timezone.now() + timedelta(hours=1)
|
||||
return {
|
||||
'topic': 'Test Meeting',
|
||||
'start_time': start_time.strftime('%Y-%m-%dT%H:%M'),
|
||||
'duration': 60
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def interview_schedule_form_data(job):
|
||||
"""Basic interview schedule form data for testing"""
|
||||
# Create candidates first
|
||||
candidates = []
|
||||
for i in range(2):
|
||||
candidate = Candidate.objects.create(
|
||||
first_name=f'Interview{i}',
|
||||
last_name=f'Candidate{i}',
|
||||
email=f'interview{i}@example.com',
|
||||
phone=f'12345678{i}',
|
||||
job=job,
|
||||
stage='Interview'
|
||||
)
|
||||
candidates.append(candidate)
|
||||
|
||||
return {
|
||||
'candidates': [c.pk for c in candidates],
|
||||
'start_date': (date.today() + timedelta(days=1)).isoformat(),
|
||||
'end_date': (date.today() + timedelta(days=7)).isoformat(),
|
||||
'working_days': [0, 1, 2, 3, 4],
|
||||
'start_time': '09:00',
|
||||
'end_time': '17:00',
|
||||
'interview_duration': '60',
|
||||
'buffer_time': '15'
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
"""Django test client"""
|
||||
from django.test import Client
|
||||
return Client()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def authenticated_client(client, user):
|
||||
"""Authenticated Django test client"""
|
||||
client.force_login(user)
|
||||
return client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def authenticated_staff_client(client, staff_user):
|
||||
"""Authenticated staff Django test client"""
|
||||
client.force_login(staff_user)
|
||||
return client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_zoom_api():
|
||||
"""Mock Zoom API responses"""
|
||||
with pytest.MonkeyPatch().context() as m:
|
||||
m.setattr('recruitment.utils.create_zoom_meeting', lambda *args, **kwargs: {
|
||||
'status': 'success',
|
||||
'meeting_details': {
|
||||
'meeting_id': '123456789',
|
||||
'join_url': 'https://zoom.us/j/123456789',
|
||||
'password': 'meeting123'
|
||||
},
|
||||
'zoom_gateway_response': {'status': 'waiting'}
|
||||
})
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_time_slots():
|
||||
"""Mock available time slots for interview scheduling"""
|
||||
return [
|
||||
{'date': date.today() + timedelta(days=1), 'time': '10:00'},
|
||||
{'date': date.today() + timedelta(days=1), 'time': '11:00'},
|
||||
{'date': date.today() + timedelta(days=1), 'time': '14:00'},
|
||||
{'date': date.today() + timedelta(days=2), 'time': '09:00'},
|
||||
{'date': date.today() + timedelta(days=2), 'time': '15:00'}
|
||||
]
|
||||
|
||||
|
||||
# Test markers
|
||||
def pytest_configure(config):
|
||||
"""Configure custom markers"""
|
||||
config.addinivalue_line(
|
||||
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "integration: marks tests as integration tests"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "unit: marks tests as unit tests"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "security: marks tests as security tests"
|
||||
)
|
||||
config.addinivalue_line(
|
||||
"markers", "api: marks tests as API tests"
|
||||
)
|
||||
|
||||
|
||||
# Pytest hooks for better test output
|
||||
# Note: HTML reporting hooks are commented out to avoid plugin validation issues
|
||||
# def pytest_html_report_title(report):
|
||||
# """Set the HTML report title"""
|
||||
# report.title = "Recruitment Application Test Report"
|
||||
|
||||
|
||||
# def pytest_runtest_logreport(report):
|
||||
# """Customize test output"""
|
||||
# if report.when == 'call' and report.failed:
|
||||
# # Add custom information for failed tests
|
||||
# pass
|
||||
20
pytest.ini
Normal file
20
pytest.ini
Normal file
@ -0,0 +1,20 @@
|
||||
[tool:pytest]
|
||||
DJANGO_SETTINGS_MODULE = NorahUniversity.settings
|
||||
python_files = tests.py test_*.py *_tests.py
|
||||
python_classes = Test*
|
||||
python_functions = test_*
|
||||
addopts =
|
||||
--verbose
|
||||
--tb=short
|
||||
--strict-markers
|
||||
--durations=10
|
||||
--cov=recruitment
|
||||
--cov-report=term-missing
|
||||
--cov-report=html:htmlcov
|
||||
--cov-fail-under=80
|
||||
testpaths = recruitment
|
||||
markers =
|
||||
slow: marks tests as slow (deselect with '-m "not slow"')
|
||||
integration: marks tests as integration tests
|
||||
unit: marks tests as unit tests
|
||||
security: marks tests as security tests
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,7 +5,7 @@ from django.utils import timezone
|
||||
from .models import (
|
||||
JobPosting, Candidate, TrainingMaterial, ZoomMeeting,
|
||||
FormTemplate, FormStage, FormField, FormSubmission, FieldResponse,
|
||||
SharedFormTemplate, Source, HiringAgency, IntegrationLog,InterviewSchedule,Profile,JobPostingImage
|
||||
SharedFormTemplate, Source, HiringAgency, IntegrationLog,InterviewSchedule,Profile,JobPostingImage,MeetingComment
|
||||
)
|
||||
|
||||
class FormFieldInline(admin.TabularInline):
|
||||
@ -152,13 +152,13 @@ class CandidateAdmin(admin.ModelAdmin):
|
||||
'fields': ('first_name', 'last_name', 'email', 'phone', 'resume')
|
||||
}),
|
||||
('Application Details', {
|
||||
'fields': ('job', 'applied', 'stage')
|
||||
'fields': ('job', 'applied', 'stage','is_resume_parsed')
|
||||
}),
|
||||
('Interview Process', {
|
||||
'fields': ('exam_date', 'exam_status', 'interview_date', 'interview_status', 'offer_date', 'offer_status', 'join_date')
|
||||
}),
|
||||
('Scoring', {
|
||||
'fields': ('match_score', 'strengths', 'weaknesses', 'criteria_checklist')
|
||||
'fields': ('ai_analysis_data',)
|
||||
}),
|
||||
('Additional Information', {
|
||||
'fields': ('submitted_by_agency', 'created_at', 'updated_at')
|
||||
@ -206,7 +206,7 @@ class ZoomMeetingAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ['created_at', 'updated_at']
|
||||
fieldsets = (
|
||||
('Meeting Details', {
|
||||
'fields': ('topic', 'meeting_id', 'start_time', 'duration', 'timezone')
|
||||
'fields': ('topic', 'meeting_id', 'start_time', 'duration', 'timezone','status')
|
||||
}),
|
||||
('Meeting Settings', {
|
||||
'fields': ('participant_video', 'join_before_host', 'mute_upon_entry', 'waiting_room')
|
||||
@ -221,6 +221,26 @@ class ZoomMeetingAdmin(admin.ModelAdmin):
|
||||
save_on_top = True
|
||||
|
||||
|
||||
@admin.register(MeetingComment)
|
||||
class MeetingCommentAdmin(admin.ModelAdmin):
|
||||
list_display = ['meeting', 'author', 'created_at', 'updated_at']
|
||||
list_filter = ['created_at', 'author', 'meeting']
|
||||
search_fields = ['content', 'meeting__topic', 'author__username']
|
||||
readonly_fields = ['created_at', 'updated_at', 'slug']
|
||||
fieldsets = (
|
||||
('Meeting Information', {
|
||||
'fields': ('meeting', 'author')
|
||||
}),
|
||||
('Comment Content', {
|
||||
'fields': ('content',)
|
||||
}),
|
||||
('Timestamps', {
|
||||
'fields': ('created_at', 'updated_at', 'slug')
|
||||
}),
|
||||
)
|
||||
save_on_top = True
|
||||
|
||||
|
||||
@admin.register(FormTemplate)
|
||||
class FormTemplateAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'created_by', 'created_at', 'is_active']
|
||||
@ -265,4 +285,4 @@ admin.site.register(Profile)
|
||||
# admin.site.register(HiringAgency)
|
||||
|
||||
|
||||
admin.site.register(JobPostingImage)
|
||||
admin.site.register(JobPostingImage)
|
||||
|
||||
@ -7,7 +7,7 @@ from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Layout, Submit, Row, Column, Field, Div
|
||||
from .models import (
|
||||
ZoomMeeting, Candidate,TrainingMaterial,JobPosting,
|
||||
FormTemplate,InterviewSchedule,BreakTime,JobPostingImage
|
||||
FormTemplate,InterviewSchedule,BreakTime,JobPostingImage,MeetingComment,ScheduledInterview
|
||||
)
|
||||
# from django_summernote.widgets import SummernoteWidget
|
||||
from django_ckeditor_5.widgets import CKEditor5Widget
|
||||
@ -70,50 +70,50 @@ class CandidateStageForm(forms.ModelForm):
|
||||
'stage': forms.Select(attrs={'class': 'form-select'}),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
# Get the current candidate instance for validation
|
||||
self.candidate = kwargs.pop('candidate', None)
|
||||
super().__init__(*args, **kwargs)
|
||||
# def __init__(self, *args, **kwargs):
|
||||
# # Get the current candidate instance for validation
|
||||
# self.candidate = kwargs.pop('candidate', None)
|
||||
# super().__init__(*args, **kwargs)
|
||||
|
||||
# Dynamically filter stage choices based on current stage
|
||||
if self.candidate and self.candidate.pk:
|
||||
current_stage = self.candidate.stage
|
||||
available_stages = self.candidate.get_available_stages()
|
||||
# # Dynamically filter stage choices based on current stage
|
||||
# if self.candidate and self.candidate.pk:
|
||||
# current_stage = self.candidate.stage
|
||||
# available_stages = self.candidate.get_available_stages()
|
||||
|
||||
# Filter choices to only include available stages
|
||||
choices = [(stage, self.candidate.Stage(stage).label)
|
||||
for stage in available_stages]
|
||||
self.fields['stage'].choices = choices
|
||||
# # Filter choices to only include available stages
|
||||
# choices = [(stage, self.candidate.Stage(stage).label)
|
||||
# for stage in available_stages]
|
||||
# self.fields['stage'].choices = choices
|
||||
|
||||
# Set initial value to current stage
|
||||
self.fields['stage'].initial = current_stage
|
||||
else:
|
||||
# For new candidates, only show 'Applied' stage
|
||||
self.fields['stage'].choices = [('Applied', _('Applied'))]
|
||||
self.fields['stage'].initial = 'Applied'
|
||||
# # Set initial value to current stage
|
||||
# self.fields['stage'].initial = current_stage
|
||||
# else:
|
||||
# # For new candidates, only show 'Applied' stage
|
||||
# self.fields['stage'].choices = [('Applied', _('Applied'))]
|
||||
# self.fields['stage'].initial = 'Applied'
|
||||
|
||||
def clean_stage(self):
|
||||
"""Validate stage transition"""
|
||||
new_stage = self.cleaned_data.get('stage')
|
||||
if not new_stage:
|
||||
raise forms.ValidationError(_('Please select a stage.'))
|
||||
# def clean_stage(self):
|
||||
# """Validate stage transition"""
|
||||
# new_stage = self.cleaned_data.get('stage')
|
||||
# if not new_stage:
|
||||
# raise forms.ValidationError(_('Please select a stage.'))
|
||||
|
||||
# Use model validation for stage transitions
|
||||
if self.candidate and self.candidate.pk:
|
||||
current_stage = self.candidate.stage
|
||||
if new_stage != current_stage:
|
||||
if not self.candidate.can_transition_to(new_stage):
|
||||
allowed_stages = self.candidate.get_available_stages()
|
||||
raise forms.ValidationError(
|
||||
_('Cannot transition from "%(current)s" to "%(new)s". '
|
||||
'Allowed transitions: %(allowed)s') % {
|
||||
'current': current_stage,
|
||||
'new': new_stage,
|
||||
'allowed': ', '.join(allowed_stages) or 'None (final stage)'
|
||||
}
|
||||
)
|
||||
# # Use model validation for stage transitions
|
||||
# if self.candidate and self.candidate.pk:
|
||||
# current_stage = self.candidate.stage
|
||||
# if new_stage != current_stage:
|
||||
# if not self.candidate.can_transition_to(new_stage):
|
||||
# allowed_stages = self.candidate.get_available_stages()
|
||||
# raise forms.ValidationError(
|
||||
# _('Cannot transition from "%(current)s" to "%(new)s". '
|
||||
# 'Allowed transitions: %(allowed)s') % {
|
||||
# 'current': current_stage,
|
||||
# 'new': new_stage,
|
||||
# 'allowed': ', '.join(allowed_stages) or 'None (final stage)'
|
||||
# }
|
||||
# )
|
||||
|
||||
return new_stage
|
||||
# return new_stage
|
||||
|
||||
class ZoomMeetingForm(forms.ModelForm):
|
||||
class Meta:
|
||||
@ -564,6 +564,33 @@ class InterviewScheduleForm(forms.ModelForm):
|
||||
# Convert string values to integers
|
||||
return [int(day) for day in working_days]
|
||||
|
||||
class MeetingCommentForm(forms.ModelForm):
|
||||
"""Form for creating and editing meeting comments"""
|
||||
class Meta:
|
||||
model = MeetingComment
|
||||
fields = ['content']
|
||||
widgets = {
|
||||
'content': CKEditor5Widget(
|
||||
attrs={'class': 'form-control', 'placeholder': _('Enter your comment or note')},
|
||||
config_name='extends'
|
||||
),
|
||||
}
|
||||
labels = {
|
||||
'content': _('Comment'),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.form_method = 'post'
|
||||
self.helper.form_class = 'form-horizontal'
|
||||
self.helper.label_class = 'col-md-3'
|
||||
self.helper.field_class = 'col-md-9'
|
||||
self.helper.layout = Layout(
|
||||
Field('content', css_class='form-control'),
|
||||
Submit('submit', _('Add Comment'), css_class='btn btn-primary mt-3')
|
||||
)
|
||||
|
||||
# --- ScheduleInterviewForCandiateForm remains unchanged ---
|
||||
class ScheduleInterviewForCandiateForm(forms.ModelForm):
|
||||
|
||||
@ -580,3 +607,10 @@ class ScheduleInterviewForCandiateForm(forms.ModelForm):
|
||||
'break_start_time': forms.TimeInput(attrs={'type': 'time', 'class': 'form-control'}),
|
||||
'break_end_time': forms.TimeInput(attrs={'type': 'time', 'class': 'form-control'}),
|
||||
}
|
||||
|
||||
|
||||
class InterviewForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = ScheduledInterview
|
||||
fields = ['job','candidate']
|
||||
35
recruitment/migrations/0021_meetingcomment.py
Normal file
35
recruitment/migrations/0021_meetingcomment.py
Normal file
@ -0,0 +1,35 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-16 13:52
|
||||
|
||||
import django.db.models.deletion
|
||||
import django_ckeditor_5.fields
|
||||
import django_extensions.db.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0020_alter_interviewschedule_created_at'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='MeetingComment',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')),
|
||||
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')),
|
||||
('slug', django_extensions.db.fields.RandomCharField(blank=True, editable=False, length=8, unique=True, verbose_name='Slug')),
|
||||
('content', django_ckeditor_5.fields.CKEditor5Field(verbose_name='Content')),
|
||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='meeting_comments', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
|
||||
('meeting', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='recruitment.zoommeeting', verbose_name='Meeting')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Meeting Comment',
|
||||
'verbose_name_plural': 'Meeting Comments',
|
||||
'ordering': ['-created_at'],
|
||||
},
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-16 19:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0021_meetingcomment'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='candidate',
|
||||
name='resume_parsed_category',
|
||||
field=models.TextField(blank=True, verbose_name='Resume Parsed Category'),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-16 19:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0022_candidate_resume_parsed_category'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='jobposting',
|
||||
name='max_applications',
|
||||
field=models.PositiveIntegerField(blank=True, default=1000, help_text='Maximum number of applications allowed', null=True),
|
||||
),
|
||||
]
|
||||
18
recruitment/migrations/0024_alter_zoommeeting_status.py
Normal file
18
recruitment/migrations/0024_alter_zoommeeting_status.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-17 20:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0023_alter_jobposting_max_applications'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='zoommeeting',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, default='waiting', max_length=20, null=True, verbose_name='Status'),
|
||||
),
|
||||
]
|
||||
18
recruitment/migrations/0025_candidate_recommendation.py
Normal file
18
recruitment/migrations/0025_candidate_recommendation.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-17 21:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0024_alter_zoommeeting_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='candidate',
|
||||
name='recommendation',
|
||||
field=models.TextField(blank=True, verbose_name='Recommendation'),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,22 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-17 21:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0025_candidate_recommendation'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='resume_parsed_category',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='candidate',
|
||||
name='major_category_name',
|
||||
field=models.TextField(blank=True, verbose_name='Major Category Name'),
|
||||
),
|
||||
]
|
||||
159
recruitment/migrations/0027_alter_candidate_email_and_more.py
Normal file
159
recruitment/migrations/0027_alter_candidate_email_and_more.py
Normal file
@ -0,0 +1,159 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-18 17:51
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0026_remove_candidate_resume_parsed_category_and_more'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='candidate',
|
||||
name='email',
|
||||
field=models.EmailField(db_index=True, max_length=254, verbose_name='Email'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='candidate',
|
||||
name='major_category_name',
|
||||
field=models.TextField(blank=True, db_index=True, verbose_name='Major Category Name'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='candidate',
|
||||
name='match_score',
|
||||
field=models.IntegerField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='candidate',
|
||||
name='stage',
|
||||
field=models.CharField(choices=[('Applied', 'Applied'), ('Exam', 'Exam'), ('Interview', 'Interview'), ('Offer', 'Offer')], db_index=True, default='Applied', max_length=100, verbose_name='Stage'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formsubmission',
|
||||
name='applicant_email',
|
||||
field=models.EmailField(blank=True, db_index=True, help_text='Email of the applicant', max_length=254),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='formsubmission',
|
||||
name='submitted_at',
|
||||
field=models.DateTimeField(auto_now_add=True, db_index=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='interviewschedule',
|
||||
name='end_date',
|
||||
field=models.DateField(db_index=True, verbose_name='End Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='interviewschedule',
|
||||
name='start_date',
|
||||
field=models.DateField(db_index=True, verbose_name='Start Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='jobposting',
|
||||
name='application_deadline',
|
||||
field=models.DateField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='jobposting',
|
||||
name='published_at',
|
||||
field=models.DateTimeField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='jobposting',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('DRAFT', 'Draft'), ('ACTIVE', 'Active'), ('CLOSED', 'Closed'), ('CANCELLED', 'Cancelled'), ('ARCHIVED', 'Archived')], db_index=True, default='DRAFT', max_length=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='scheduledinterview',
|
||||
name='interview_date',
|
||||
field=models.DateField(db_index=True, verbose_name='Interview Date'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='scheduledinterview',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('scheduled', 'Scheduled'), ('confirmed', 'Confirmed'), ('cancelled', 'Cancelled'), ('completed', 'Completed')], db_index=True, default='scheduled', max_length=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='zoommeeting',
|
||||
name='meeting_id',
|
||||
field=models.CharField(db_index=True, max_length=20, unique=True, verbose_name='Meeting ID'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='zoommeeting',
|
||||
name='start_time',
|
||||
field=models.DateTimeField(db_index=True, verbose_name='Start Time'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='zoommeeting',
|
||||
name='status',
|
||||
field=models.CharField(blank=True, db_index=True, default='waiting', max_length=20, null=True, verbose_name='Status'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='candidate',
|
||||
index=models.Index(fields=['job', 'stage'], name='recruitment_job_id_766dbe_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='candidate',
|
||||
index=models.Index(fields=['job', 'stage', 'match_score'], name='recruitment_job_id_bd6512_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='candidate',
|
||||
index=models.Index(fields=['created_at'], name='recruitment_created_73590f_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='fieldresponse',
|
||||
index=models.Index(fields=['submission'], name='recruitment_submiss_474130_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='fieldresponse',
|
||||
index=models.Index(fields=['field'], name='recruitment_field_i_097e5b_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='formsubmission',
|
||||
index=models.Index(fields=['submitted_at'], name='recruitment_submitt_7946c8_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='formtemplate',
|
||||
index=models.Index(fields=['created_at'], name='recruitment_created_c21775_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='formtemplate',
|
||||
index=models.Index(fields=['is_active'], name='recruitment_is_acti_ae5efb_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='interviewschedule',
|
||||
index=models.Index(fields=['start_date'], name='recruitment_start_d_15d55e_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='interviewschedule',
|
||||
index=models.Index(fields=['end_date'], name='recruitment_end_dat_aeb00e_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='interviewschedule',
|
||||
index=models.Index(fields=['created_by'], name='recruitment_created_d0bdcc_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='jobposting',
|
||||
index=models.Index(fields=['status', 'created_at'], name='recruitment_status_42c036_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='jobposting',
|
||||
index=models.Index(fields=['slug'], name='recruitment_slug_004045_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledinterview',
|
||||
index=models.Index(fields=['job', 'status'], name='recruitment_job_id_f09e22_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledinterview',
|
||||
index=models.Index(fields=['interview_date', 'interview_time'], name='recruitment_intervi_7f5877_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='scheduledinterview',
|
||||
index=models.Index(fields=['candidate', 'job'], name='recruitment_candida_43d5b0_idx'),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-18 21:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0027_alter_candidate_email_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='candidate',
|
||||
name='interview_status',
|
||||
field=models.CharField(blank=True, choices=[('Passed', 'Passed'), ('Failed', 'Failed')], max_length=100, null=True, verbose_name='Interview Status'),
|
||||
),
|
||||
]
|
||||
@ -0,0 +1,62 @@
|
||||
# Generated by Django 5.2.4 on 2025-10-19 10:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0028_alter_candidate_interview_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveIndex(
|
||||
model_name='candidate',
|
||||
name='recruitment_job_id_766dbe_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='candidate',
|
||||
name='recruitment_job_id_bd6512_idx',
|
||||
),
|
||||
migrations.RemoveIndex(
|
||||
model_name='jobposting',
|
||||
name='recruitment_status_42c036_idx',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='criteria_checklist',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='major_category_name',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='match_score',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='recommendation',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='strengths',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='candidate',
|
||||
name='weaknesses',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='candidate',
|
||||
name='ai_analysis_data',
|
||||
field=models.JSONField(default=dict, help_text='Full JSON output from the resume scoring model.', verbose_name='AI Analysis Data'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='candidate',
|
||||
index=models.Index(fields=['stage'], name='recruitment_stage_f1c6eb_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='jobposting',
|
||||
index=models.Index(fields=['status', 'created_at', 'title'], name='recruitment_status_8b77aa_idx'),
|
||||
),
|
||||
]
|
||||
17
recruitment/migrations/0030_alter_candidate_options.py
Normal file
17
recruitment/migrations/0030_alter_candidate_options.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-19 13:39
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0029_remove_candidate_recruitment_job_id_766dbe_idx_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='candidate',
|
||||
options={'ordering': ['-ai_analysis_data__match_score', '-created_at'], 'verbose_name': 'Candidate', 'verbose_name_plural': 'Candidates'},
|
||||
),
|
||||
]
|
||||
17
recruitment/migrations/0031_alter_candidate_options.py
Normal file
17
recruitment/migrations/0031_alter_candidate_options.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.2.6 on 2025-10-19 13:43
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('recruitment', '0030_alter_candidate_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='candidate',
|
||||
options={'verbose_name': 'Candidate', 'verbose_name_plural': 'Candidates'},
|
||||
),
|
||||
]
|
||||
@ -1,7 +1,9 @@
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from typing import List,Dict,Any
|
||||
from django.utils import timezone
|
||||
from django.db.models import JSONField
|
||||
from django.db.models import FloatField,CharField
|
||||
from django.db.models.functions import Cast
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.validators import URLValidator
|
||||
from django_countries.fields import CountryField
|
||||
@ -78,7 +80,7 @@ class JobPosting(Base):
|
||||
blank=True,
|
||||
)
|
||||
application_start_date=models.DateField(null=True, blank=True)
|
||||
application_deadline = models.DateField(null=True, blank=True)
|
||||
application_deadline = models.DateField(db_index=True, null=True, blank=True) # Added index
|
||||
application_instructions =CKEditor5Field(
|
||||
blank=True, null=True,config_name='extends'
|
||||
)
|
||||
@ -98,7 +100,7 @@ class JobPosting(Base):
|
||||
("ARCHIVED", "Archived"),
|
||||
]
|
||||
status = models.CharField(
|
||||
max_length=20, choices=STATUS_CHOICES, default="DRAFT"
|
||||
db_index=True, max_length=20, choices=STATUS_CHOICES, default="DRAFT" # Added index
|
||||
)
|
||||
|
||||
# hashtags for social media
|
||||
@ -122,7 +124,7 @@ class JobPosting(Base):
|
||||
)
|
||||
linkedin_posted_at = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
published_at = models.DateTimeField(null=True, blank=True)
|
||||
published_at = models.DateTimeField(db_index=True, null=True, blank=True) # Added index
|
||||
# University Specific Fields
|
||||
position_number = models.CharField(
|
||||
max_length=50, blank=True, help_text="University position number"
|
||||
@ -142,9 +144,10 @@ class JobPosting(Base):
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="The system or channel from which this job posting originated or was first published.",
|
||||
db_index=True # Explicitly index ForeignKey
|
||||
)
|
||||
max_applications = models.PositiveIntegerField(
|
||||
default=1000, help_text="Maximum number of applications allowed"
|
||||
default=1000, help_text="Maximum number of applications allowed",null=True,blank=True
|
||||
)
|
||||
hiring_agency = models.ManyToManyField(
|
||||
"HiringAgency",
|
||||
@ -172,6 +175,10 @@ class JobPosting(Base):
|
||||
ordering = ["-created_at"]
|
||||
verbose_name = "Job Posting"
|
||||
verbose_name_plural = "Job Postings"
|
||||
indexes = [
|
||||
models.Index(fields=['status', 'created_at','title']),
|
||||
models.Index(fields=['slug']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} - {self.internal_job_id}-{self.get_status_display()}"
|
||||
@ -239,7 +246,23 @@ class JobPosting(Base):
|
||||
return True
|
||||
|
||||
return self.current_applications_count >= self.max_applications
|
||||
@property
|
||||
def all_candidates(self):
|
||||
return self.candidates.annotate(sortable_score=Cast('ai_analysis_data__match_score',output_field=CharField())).order_by('-sortable_score')
|
||||
@property
|
||||
def screening_candidates(self):
|
||||
return self.all_candidates.filter(stage="Applied")
|
||||
|
||||
@property
|
||||
def exam_candidates(self):
|
||||
return self.all_candidates.filter(stage="Exam")
|
||||
@property
|
||||
def interview_candidates(self):
|
||||
return self.all_candidates.filter(stage="Interview")
|
||||
|
||||
@property
|
||||
def offer_candidates(self):
|
||||
return self.all_candidates.filter(stage="Offer")
|
||||
|
||||
class JobPostingImage(models.Model):
|
||||
job=models.OneToOneField('JobPosting',on_delete=models.CASCADE,related_name='post_images')
|
||||
@ -281,7 +304,7 @@ class Candidate(Base):
|
||||
)
|
||||
first_name = models.CharField(max_length=255, verbose_name=_("First Name"))
|
||||
last_name = models.CharField(max_length=255, verbose_name=_("Last Name"))
|
||||
email = models.EmailField(verbose_name=_("Email"))
|
||||
email = models.EmailField(db_index=True, verbose_name=_("Email")) # Added index
|
||||
phone = models.CharField(max_length=20, verbose_name=_("Phone"))
|
||||
address = models.TextField(max_length=200, verbose_name=_("Address"))
|
||||
resume = models.FileField(upload_to="resumes/", verbose_name=_("Resume"))
|
||||
@ -294,7 +317,7 @@ class Candidate(Base):
|
||||
parsed_summary = models.TextField(blank=True, verbose_name=_("Parsed Summary"))
|
||||
applied = models.BooleanField(default=False, verbose_name=_("Applied"))
|
||||
stage = models.CharField(
|
||||
max_length=100,
|
||||
db_index=True, max_length=100, # Added index
|
||||
default="Applied",
|
||||
choices=Stage.choices,
|
||||
verbose_name=_("Stage"),
|
||||
@ -319,7 +342,7 @@ class Candidate(Base):
|
||||
null=True, blank=True, verbose_name=_("Interview Date")
|
||||
)
|
||||
interview_status = models.CharField(
|
||||
choices=Status.choices,
|
||||
choices=ExamStatus.choices,
|
||||
max_length=100,
|
||||
null=True,
|
||||
blank=True,
|
||||
@ -334,13 +357,18 @@ class Candidate(Base):
|
||||
verbose_name=_("Offer Status"),
|
||||
)
|
||||
join_date = models.DateField(null=True, blank=True, verbose_name=_("Join Date"))
|
||||
|
||||
ai_analysis_data = models.JSONField(
|
||||
verbose_name="AI Analysis Data",
|
||||
default=dict,
|
||||
help_text="Full JSON output from the resume scoring model."
|
||||
)
|
||||
# Scoring fields (populated by signal)
|
||||
match_score = models.IntegerField(null=True, blank=True)
|
||||
strengths = models.TextField(blank=True)
|
||||
weaknesses = models.TextField(blank=True)
|
||||
criteria_checklist = models.JSONField(default=dict, blank=True)
|
||||
|
||||
# match_score = models.IntegerField(db_index=True, null=True, blank=True) # Added index
|
||||
# strengths = models.TextField(blank=True)
|
||||
# weaknesses = models.TextField(blank=True)
|
||||
# criteria_checklist = models.JSONField(default=dict, blank=True)
|
||||
# major_category_name = models.TextField(db_index=True, blank=True, verbose_name=_("Major Category Name")) # Added index
|
||||
# recommendation = models.TextField(blank=True, verbose_name=_("Recommendation"))
|
||||
submitted_by_agency = models.ForeignKey(
|
||||
"HiringAgency",
|
||||
on_delete=models.SET_NULL,
|
||||
@ -353,6 +381,103 @@ class Candidate(Base):
|
||||
class Meta:
|
||||
verbose_name = _("Candidate")
|
||||
verbose_name_plural = _("Candidates")
|
||||
indexes = [
|
||||
models.Index(fields=['stage']),
|
||||
models.Index(fields=['created_at']),
|
||||
]
|
||||
def set_field(self, key: str, value: Any):
|
||||
"""
|
||||
Generic method to set any single key-value pair and save.
|
||||
"""
|
||||
self.ai_analysis_data[key] = value
|
||||
self.save(update_fields=['ai_analysis_data'])
|
||||
|
||||
# ====================================================================
|
||||
# ✨ PROPERTIES (GETTERS)
|
||||
# ====================================================================
|
||||
|
||||
@property
|
||||
def match_score(self) -> int:
|
||||
"""1. A score from 0 to 100 representing how well the candidate fits the role."""
|
||||
return self.ai_analysis_data.get('match_score', 0)
|
||||
|
||||
@property
|
||||
def years_of_experience(self) -> float:
|
||||
"""4. The total number of years of professional experience as a numerical value."""
|
||||
return self.ai_analysis_data.get('years_of_experience', 0.0)
|
||||
|
||||
@property
|
||||
def soft_skills_score(self) -> int:
|
||||
"""15. A score (0-100) for inferred non-technical skills."""
|
||||
return self.ai_analysis_data.get('soft_skills_score', 0)
|
||||
|
||||
@property
|
||||
def industry_match_score(self) -> int:
|
||||
"""16. A score (0-100) for the relevance of the candidate's industry experience."""
|
||||
# Renamed to clarify: experience_industry_match
|
||||
return self.ai_analysis_data.get('experience_industry_match', 0)
|
||||
|
||||
# --- Properties for Funnel & Screening Efficiency ---
|
||||
|
||||
@property
|
||||
def min_requirements_met(self) -> bool:
|
||||
"""14. Boolean (true/false) indicating if all non-negotiable minimum requirements are met."""
|
||||
return self.ai_analysis_data.get('min_req_met_bool', False)
|
||||
|
||||
@property
|
||||
def screening_stage_rating(self) -> str:
|
||||
"""13. A standardized rating (e.g., "A - Highly Qualified", "B - Qualified")."""
|
||||
return self.ai_analysis_data.get('screening_stage_rating', 'N/A')
|
||||
|
||||
@property
|
||||
def top_3_keywords(self) -> List[str]:
|
||||
"""10. A list of the three most dominant and relevant technical skills or technologies."""
|
||||
return self.ai_analysis_data.get('top_3_keywords', [])
|
||||
|
||||
@property
|
||||
def most_recent_job_title(self) -> str:
|
||||
"""8. The candidate's most recent or current professional job title."""
|
||||
return self.ai_analysis_data.get('most_recent_job_title', 'N/A')
|
||||
|
||||
# --- Properties for Structured Detail ---
|
||||
|
||||
@property
|
||||
def criteria_checklist(self) -> Dict[str, str]:
|
||||
"""5 & 6. An object rating the candidate's match for each specific criterion."""
|
||||
return self.ai_analysis_data.get('criteria_checklist', {})
|
||||
|
||||
@property
|
||||
def professional_category(self) -> str:
|
||||
"""7. The most fitting professional field or category for the individual."""
|
||||
return self.ai_analysis_data.get('category', 'N/A')
|
||||
|
||||
@property
|
||||
def language_fluency(self) -> List[Dict[str, str]]:
|
||||
"""12. A list of languages and their fluency levels mentioned."""
|
||||
return self.ai_analysis_data.get('language_fluency', [])
|
||||
|
||||
# --- Properties for Summaries and Narrative ---
|
||||
|
||||
@property
|
||||
def strengths(self) -> str:
|
||||
"""2. A brief summary of why the candidate is a strong fit."""
|
||||
return self.ai_analysis_data.get('strengths', '')
|
||||
|
||||
@property
|
||||
def weaknesses(self) -> str:
|
||||
"""3. A brief summary of where the candidate falls short or what criteria are missing."""
|
||||
return self.ai_analysis_data.get('weaknesses', '')
|
||||
|
||||
@property
|
||||
def job_fit_narrative(self) -> str:
|
||||
"""11. A single, concise sentence summarizing the core fit."""
|
||||
return self.ai_analysis_data.get('job_fit_narrative', '')
|
||||
|
||||
@property
|
||||
def recommendation(self) -> str:
|
||||
"""9. Provide a detailed final recommendation for the candidate."""
|
||||
# Using a more descriptive name to avoid conflict with potential built-in methods
|
||||
return self.ai_analysis_data.get('recommendation', '')
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -448,16 +573,16 @@ class TrainingMaterial(Base):
|
||||
|
||||
class ZoomMeeting(Base):
|
||||
class MeetingStatus(models.TextChoices):
|
||||
SCHEDULED = "scheduled", _("Scheduled")
|
||||
WAITING = "waiting", _("Waiting")
|
||||
STARTED = "started", _("Started")
|
||||
ENDED = "ended", _("Ended")
|
||||
CANCELLED = "cancelled",_("Cancelled")
|
||||
# Basic meeting details
|
||||
topic = models.CharField(max_length=255, verbose_name=_("Topic"))
|
||||
meeting_id = models.CharField(
|
||||
max_length=20, unique=True, verbose_name=_("Meeting ID")
|
||||
db_index=True, max_length=20, unique=True, verbose_name=_("Meeting ID") # Added index
|
||||
) # Unique identifier for the meeting
|
||||
start_time = models.DateTimeField(verbose_name=_("Start Time"))
|
||||
start_time = models.DateTimeField(db_index=True, verbose_name=_("Start Time")) # Added index
|
||||
duration = models.PositiveIntegerField(
|
||||
verbose_name=_("Duration")
|
||||
) # Duration in minutes
|
||||
@ -483,10 +608,11 @@ class ZoomMeeting(Base):
|
||||
blank=True, null=True, verbose_name=_("Zoom Gateway Response")
|
||||
)
|
||||
status = models.CharField(
|
||||
max_length=20,
|
||||
db_index=True, max_length=20, # Added index
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name=_("Status"),
|
||||
default=MeetingStatus.WAITING,
|
||||
)
|
||||
# Timestamps
|
||||
|
||||
@ -494,20 +620,51 @@ class ZoomMeeting(Base):
|
||||
return self.topic
|
||||
|
||||
|
||||
class MeetingComment(Base):
|
||||
"""
|
||||
Model for storing meeting comments/notes
|
||||
"""
|
||||
meeting = models.ForeignKey(
|
||||
ZoomMeeting,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="comments",
|
||||
verbose_name=_("Meeting")
|
||||
)
|
||||
author = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="meeting_comments",
|
||||
verbose_name=_("Author")
|
||||
)
|
||||
content = CKEditor5Field(
|
||||
verbose_name=_("Content"),
|
||||
config_name='extends'
|
||||
)
|
||||
# Inherited from Base: created_at, updated_at, slug
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Meeting Comment")
|
||||
verbose_name_plural = _("Meeting Comments")
|
||||
ordering = ['-created_at']
|
||||
|
||||
def __str__(self):
|
||||
return f"Comment by {self.author.get_username()} on {self.meeting.topic}"
|
||||
|
||||
|
||||
class FormTemplate(Base):
|
||||
"""
|
||||
Represents a complete form template with multiple stages
|
||||
"""
|
||||
|
||||
job = models.OneToOneField(
|
||||
JobPosting, on_delete=models.CASCADE, related_name="form_template"
|
||||
JobPosting, on_delete=models.CASCADE, related_name="form_template", db_index=True
|
||||
)
|
||||
name = models.CharField(max_length=200, help_text="Name of the form template")
|
||||
description = models.TextField(
|
||||
blank=True, help_text="Description of the form template"
|
||||
)
|
||||
created_by = models.ForeignKey(
|
||||
User, on_delete=models.CASCADE, related_name="form_templates",null=True,blank=True
|
||||
User, on_delete=models.CASCADE, related_name="form_templates",null=True,blank=True, db_index=True
|
||||
)
|
||||
is_active = models.BooleanField(
|
||||
default=False, help_text="Whether this template is active"
|
||||
@ -517,6 +674,10 @@ class FormTemplate(Base):
|
||||
ordering = ["-created_at"]
|
||||
verbose_name = "Form Template"
|
||||
verbose_name_plural = "Form Templates"
|
||||
indexes = [
|
||||
models.Index(fields=['created_at']),
|
||||
models.Index(fields=['is_active']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@ -534,7 +695,7 @@ class FormStage(Base):
|
||||
"""
|
||||
|
||||
template = models.ForeignKey(
|
||||
FormTemplate, on_delete=models.CASCADE, related_name="stages"
|
||||
FormTemplate, on_delete=models.CASCADE, related_name="stages", db_index=True
|
||||
)
|
||||
name = models.CharField(max_length=200, help_text="Name of the stage")
|
||||
order = models.PositiveIntegerField(
|
||||
@ -575,7 +736,7 @@ class FormField(Base):
|
||||
]
|
||||
|
||||
stage = models.ForeignKey(
|
||||
FormStage, on_delete=models.CASCADE, related_name="fields"
|
||||
FormStage, on_delete=models.CASCADE, related_name="fields", db_index=True
|
||||
)
|
||||
label = models.CharField(max_length=200, help_text="Label for the field")
|
||||
field_type = models.CharField(
|
||||
@ -666,7 +827,7 @@ class FormSubmission(Base):
|
||||
"""
|
||||
|
||||
template = models.ForeignKey(
|
||||
FormTemplate, on_delete=models.CASCADE, related_name="submissions"
|
||||
FormTemplate, on_delete=models.CASCADE, related_name="submissions", db_index=True
|
||||
)
|
||||
submitted_by = models.ForeignKey(
|
||||
User,
|
||||
@ -674,17 +835,21 @@ class FormSubmission(Base):
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="form_submissions",
|
||||
db_index=True
|
||||
)
|
||||
submitted_at = models.DateTimeField(auto_now_add=True)
|
||||
submitted_at = models.DateTimeField(db_index=True, auto_now_add=True) # Added index
|
||||
applicant_name = models.CharField(
|
||||
max_length=200, blank=True, help_text="Name of the applicant"
|
||||
)
|
||||
applicant_email = models.EmailField(blank=True, help_text="Email of the applicant")
|
||||
applicant_email = models.EmailField(db_index=True, blank=True, help_text="Email of the applicant") # Added index
|
||||
|
||||
class Meta:
|
||||
ordering = ["-submitted_at"]
|
||||
verbose_name = "Form Submission"
|
||||
verbose_name_plural = "Form Submissions"
|
||||
indexes = [
|
||||
models.Index(fields=['submitted_at']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"Submission for {self.template.name} - {self.submitted_at.strftime('%Y-%m-%d %H:%M')}"
|
||||
@ -696,10 +861,10 @@ class FieldResponse(Base):
|
||||
"""
|
||||
|
||||
submission = models.ForeignKey(
|
||||
FormSubmission, on_delete=models.CASCADE, related_name="responses"
|
||||
FormSubmission, on_delete=models.CASCADE, related_name="responses", db_index=True
|
||||
)
|
||||
field = models.ForeignKey(
|
||||
FormField, on_delete=models.CASCADE, related_name="responses"
|
||||
FormField, on_delete=models.CASCADE, related_name="responses", db_index=True
|
||||
)
|
||||
|
||||
# Store the response value as JSON to handle different data types
|
||||
@ -713,6 +878,10 @@ class FieldResponse(Base):
|
||||
class Meta:
|
||||
verbose_name = "Field Response"
|
||||
verbose_name_plural = "Field Responses"
|
||||
indexes = [
|
||||
models.Index(fields=['submission']),
|
||||
models.Index(fields=['field']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"Response to {self.field.label} in {self.submission}"
|
||||
@ -950,11 +1119,11 @@ class InterviewSchedule(Base):
|
||||
"""Stores the scheduling criteria for interviews"""
|
||||
|
||||
job = models.ForeignKey(
|
||||
JobPosting, on_delete=models.CASCADE, related_name="interview_schedules"
|
||||
JobPosting, on_delete=models.CASCADE, related_name="interview_schedules", db_index=True
|
||||
)
|
||||
candidates = models.ManyToManyField(Candidate, related_name="interview_schedules", blank=True,null=True)
|
||||
start_date = models.DateField(verbose_name=_("Start Date"))
|
||||
end_date = models.DateField(verbose_name=_("End Date"))
|
||||
start_date = models.DateField(db_index=True, verbose_name=_("Start Date")) # Added index
|
||||
end_date = models.DateField(db_index=True, verbose_name=_("End Date")) # Added index
|
||||
working_days = models.JSONField(
|
||||
verbose_name=_("Working Days")
|
||||
) # Store days of week as [0,1,2,3,4] for Mon-Fri
|
||||
@ -970,11 +1139,18 @@ class InterviewSchedule(Base):
|
||||
buffer_time = models.PositiveIntegerField(
|
||||
verbose_name=_("Buffer Time (minutes)"), default=0
|
||||
)
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True) # Added index
|
||||
|
||||
def __str__(self):
|
||||
return f"Interview Schedule for {self.job.title}"
|
||||
|
||||
class Meta:
|
||||
indexes = [
|
||||
models.Index(fields=['start_date']),
|
||||
models.Index(fields=['end_date']),
|
||||
models.Index(fields=['created_by']),
|
||||
]
|
||||
|
||||
|
||||
class ScheduledInterview(Base):
|
||||
"""Stores individual scheduled interviews"""
|
||||
@ -983,21 +1159,22 @@ class ScheduledInterview(Base):
|
||||
Candidate,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="scheduled_interviews",
|
||||
db_index=True
|
||||
)
|
||||
job = models.ForeignKey(
|
||||
"JobPosting", on_delete=models.CASCADE, related_name="scheduled_interviews"
|
||||
"JobPosting", on_delete=models.CASCADE, related_name="scheduled_interviews", db_index=True
|
||||
)
|
||||
zoom_meeting = models.OneToOneField(
|
||||
ZoomMeeting, on_delete=models.CASCADE, related_name="interview"
|
||||
ZoomMeeting, on_delete=models.CASCADE, related_name="interview", db_index=True
|
||||
)
|
||||
schedule = models.ForeignKey(
|
||||
InterviewSchedule, on_delete=models.CASCADE, related_name="interviews",null=True,blank=True
|
||||
InterviewSchedule, on_delete=models.CASCADE, related_name="interviews",null=True,blank=True, db_index=True
|
||||
)
|
||||
|
||||
interview_date = models.DateField(verbose_name=_("Interview Date"))
|
||||
interview_date = models.DateField(db_index=True, verbose_name=_("Interview Date")) # Added index
|
||||
interview_time = models.TimeField(verbose_name=_("Interview Time"))
|
||||
status = models.CharField(
|
||||
max_length=20,
|
||||
db_index=True, max_length=20, # Added index
|
||||
choices=[
|
||||
("scheduled", _("Scheduled")),
|
||||
("confirmed", _("Confirmed")),
|
||||
@ -1011,3 +1188,10 @@ class ScheduledInterview(Base):
|
||||
|
||||
def __str__(self):
|
||||
return f"Interview with {self.candidate.name} for {self.job.title}"
|
||||
|
||||
class Meta:
|
||||
indexes = [
|
||||
models.Index(fields=['job', 'status']),
|
||||
models.Index(fields=['interview_date', 'interview_time']),
|
||||
models.Index(fields=['candidate', 'job']),
|
||||
]
|
||||
|
||||
@ -4,14 +4,18 @@ import logging
|
||||
import requests
|
||||
from PyPDF2 import PdfReader
|
||||
from datetime import datetime
|
||||
from django.db import transaction
|
||||
from .utils import create_zoom_meeting
|
||||
from recruitment.models import Candidate
|
||||
from .models import ScheduledInterview, ZoomMeeting, Candidate, JobPosting, InterviewSchedule
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
OPENROUTER_API_KEY ='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'
|
||||
OPENROUTER_MODEL = 'qwen/qwen-2.5-72b-instruct:free'
|
||||
OPENROUTER_API_KEY ='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'
|
||||
# OPENROUTER_MODEL = 'qwen/qwen-2.5-72b-instruct:free'
|
||||
# OPENROUTER_MODEL = 'openai/gpt-oss-20b:free'
|
||||
OPENROUTER_MODEL = 'openai/gpt-oss-20b'
|
||||
# OPENROUTER_MODEL = 'mistralai/mistral-small-3.2-24b-instruct:free'
|
||||
|
||||
if not OPENROUTER_API_KEY:
|
||||
logger.warning("OPENROUTER_API_KEY not set. Resume scoring will be skipped.")
|
||||
@ -49,114 +53,324 @@ def ai_handler(prompt):
|
||||
res = response.json()
|
||||
content = res["choices"][0]['message']['content']
|
||||
try:
|
||||
|
||||
# print(content)
|
||||
content = content.replace("```json","").replace("```","")
|
||||
|
||||
res = json.loads(content)
|
||||
|
||||
print("success response")
|
||||
return {"status": "success", "data": res}
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
# res = raw_output["choices"][0]["message"]["content"]
|
||||
return {"status": "error", "data": str(e)}
|
||||
else:
|
||||
print("error response")
|
||||
return res
|
||||
return {"status": "error", "data": response.json()}
|
||||
|
||||
|
||||
# def handle_reume_parsing_and_scoring(pk):
|
||||
# from django.db import transaction
|
||||
|
||||
# logger.info(f"Scoring resume for candidate {pk}")
|
||||
# instance = Candidate.objects.get(pk=pk)
|
||||
# try:
|
||||
# file_path = instance.resume.path
|
||||
# with transaction.atomic():
|
||||
# if not os.path.exists(file_path):
|
||||
# logger.warning(f"Resume file not found: {file_path}")
|
||||
# return
|
||||
|
||||
# resume_text = extract_text_from_pdf(file_path)
|
||||
# job_detail= f"{instance.job.description} {instance.job.qualifications}"
|
||||
# resume_parser_prompt = f"""
|
||||
# You are an expert resume parser and summarizer. Given a resume in plain text format, extract and organize the following key-value information into a clean, valid JSON object:
|
||||
|
||||
# full_name: Full name of the candidate
|
||||
# current_title: Most recent or current job title
|
||||
# location: City and state (or country if outside the U.S.)
|
||||
# contact: Phone number and email (as a single string or separate fields)
|
||||
# linkedin: LinkedIn profile URL (if present)
|
||||
# github: GitHub or portfolio URL (if present)
|
||||
# summary: Brief professional profile or summary (1–2 sentences)
|
||||
# education: List of degrees, each with:
|
||||
# institution
|
||||
# degree
|
||||
# year
|
||||
# gpa (if provided)
|
||||
# relevant_courses (as a list, if mentioned)
|
||||
# skills: Grouped by category if possible (e.g., programming, big data, visualization), otherwise as a flat list of technologies/tools
|
||||
# experience: List of roles, each with:
|
||||
# company
|
||||
# job_title
|
||||
# location
|
||||
# start_date and end_date (or "Present" if applicable)
|
||||
# key_achievements (as a list of concise bullet points)
|
||||
# projects: List of notable projects (if clearly labeled), each with:
|
||||
# name
|
||||
# year
|
||||
# technologies_used
|
||||
# brief_description
|
||||
# Instructions:
|
||||
|
||||
# Be concise but preserve key details.
|
||||
# Normalize formatting (e.g., “Jun. 2014” → “2014-06”).
|
||||
# Omit redundant or promotional language.
|
||||
# If a section is missing, omit the key or set it to null/empty list as appropriate.
|
||||
# Output only valid JSON—no markdown, no extra text.
|
||||
# Now, process the following resume text:
|
||||
# {resume_text}
|
||||
# """
|
||||
# resume_parser_result = ai_handler(resume_parser_prompt)
|
||||
# resume_scoring_prompt = f"""
|
||||
# You are an expert technical recruiter. Your task is to score the following candidate for the role based on the provided job criteria.
|
||||
|
||||
# **Job Criteria:**
|
||||
# {job_detail}
|
||||
|
||||
# **Candidate's Extracted Resume Json:**
|
||||
# \"\"\"
|
||||
# {resume_parser_result}
|
||||
# \"\"\"
|
||||
|
||||
# **Your Task:**
|
||||
# Provide a response in strict JSON format with the following keys:
|
||||
# 1. 'match_score': A score from 0 to 100 representing how well the candidate fits the role.
|
||||
# 2. 'strengths': A brief summary of why the candidate is a strong fit, referencing specific criteria.
|
||||
# 3. 'weaknesses': A brief summary of where the candidate falls short or what criteria are missing.
|
||||
# 4. 'years_of_experience': The total number of years of professional experience mentioned in the resume as a numerical value (e.g., 6.5).
|
||||
# 5. 'criteria_checklist': An object where you rate the candidate's match for each specific criterion (e.g., {{'Python': 'Met', 'AWS': 'Not Mentioned'}}).
|
||||
# 6. 'criteria_checklist': An object where you rate the candidate's match for each specific criterion (e.g., {{'Python': 'Met', 'AWS': 'Not Mentioned'}}).
|
||||
# 7. 'category': Based on the content provided, determine the most fitting professional field or category for the individual. (e.g., {{"category" : "Data Science"}}) only output the category name and no other text example ('Software Development', 'correct') , ('Software Development and devops','wrong').
|
||||
# 8. 'most_recent_job_title': The candidate's most recent or current professional job title.
|
||||
# 9. 'recommendation': Provide a recommendation for the candidate (e.g., {{"recommendation": "
|
||||
# Conclusion and Minor Considerations
|
||||
# Overall Assessment: Highly Recommended Candidate.
|
||||
|
||||
# [Candidate] is an exceptionally strong candidate for this role. His proven track record with the core technology stack (Django, Python, Docker, CI/CD) and relevant experience in large-scale, high-impact enterprise projects (Telecom BPM/MDM) make him an excellent technical fit. His fluency in Arabic and English directly addresses a major non-negotiable requirement.
|
||||
|
||||
# The only minor area not explicitly mentioned is the mentoring aspect, but his senior level of experience and technical breadth strongly suggest he possesses the capability to mentor junior engineers.
|
||||
|
||||
# The hiring manager should move forward with this candidate with high confidence.
|
||||
# ."}}).
|
||||
# 10. 'top_3_keywords': A list of the three most dominant and relevant technical skills or technologies from the resume that match the job criteria.
|
||||
# 11. 'job_fit_narrative': A single, concise sentence summarizing the core fit.
|
||||
# 12. 'language_fluency': A list of languages and their fluency levels mentioned.
|
||||
# 13. 'screening_stage_rating': A standardized rating (e.g., "A - Highly Qualified", "B - Qualified").
|
||||
# 14. 'min_req_met_bool': Boolean (true/false) indicating if all non-negotiable minimum requirements are met.
|
||||
# 15. 'soft_skills_score': A score (0-100) for inferred non-technical skills like leadership and communication.
|
||||
# 16. 'experience_industry_match': A score (0-100) for the relevance of the candidate's industry experience.
|
||||
|
||||
# Only output valid JSON. Do not include any other text.
|
||||
# """
|
||||
|
||||
# resume_scoring_result = ai_handler(resume_scoring_prompt)
|
||||
|
||||
# print(resume_scoring_result)
|
||||
|
||||
# instance.parsed_summary = str(resume_parser_result)
|
||||
|
||||
|
||||
# # Core Scores
|
||||
# instance.set_field('match_score', resume_scoring_result.get('match_score', 0)) # Set default for int
|
||||
# instance.set_field('years_of_experience', resume_scoring_result.get('years_of_experience', 0.0)) # Set default for float
|
||||
# instance.set_field('soft_skills_score', resume_scoring_result.get('soft_skills_score', 0))
|
||||
# instance.set_field('experience_industry_match', resume_scoring_result.get('experience_industry_match', 0))
|
||||
|
||||
# # Screening & Funnel
|
||||
# instance.set_field('min_req_met_bool', resume_scoring_result.get('min_req_met_bool', False)) # Set default for bool
|
||||
# instance.set_field('screening_stage_rating', resume_scoring_result.get('screening_stage_rating', 'N/A'))
|
||||
# instance.set_field('most_recent_job_title', resume_scoring_result.get('most_recent_job_title', 'N/A'))
|
||||
# instance.set_field('top_3_keywords', resume_scoring_result.get('top_3_keywords', [])) # Set default for list
|
||||
|
||||
# # Summaries & Narrative
|
||||
# instance.set_field('strengths', resume_scoring_result.get('strengths', ''))
|
||||
# instance.set_field('weaknesses', resume_scoring_result.get('weaknesses', ''))
|
||||
# instance.set_field('job_fit_narrative', resume_scoring_result.get('job_fit_narrative', ''))
|
||||
# instance.set_field('recommendation', resume_scoring_result.get('recommendation', ''))
|
||||
|
||||
# # Structured Data
|
||||
# instance.set_field('criteria_checklist', resume_scoring_result.get('criteria_checklist', {})) # Set default for dict
|
||||
# instance.set_field('language_fluency', resume_scoring_result.get('language_fluency', [])) # Set default for list
|
||||
|
||||
# instance.set_field('category', resume_scoring_result.get('category', 'Uncategorized')) # Use 'category' key
|
||||
|
||||
# instance.is_resume_parsed = True
|
||||
|
||||
# instance.save(update_fields=['ai_analysis_data', 'is_resume_parsed','parsed_summary'])
|
||||
|
||||
# logger.info(f"Successfully scored resume for candidate {instance.id}")
|
||||
|
||||
# except Exception as e:
|
||||
# instance.is_resume_parsed = False
|
||||
# instance.save(update_fields=['is_resume_parsed'])
|
||||
# logger.error(f"Failed to score resume for candidate:{instance.pk} {e}")
|
||||
|
||||
def handle_reume_parsing_and_scoring(pk):
|
||||
logger.info(f"Scoring resume for candidate {pk}")
|
||||
"""
|
||||
Optimized Django-Q task to parse a resume, score the candidate against a job,
|
||||
and atomically save the results.
|
||||
"""
|
||||
|
||||
# --- 1. Robust Object Retrieval (Prevents looping on DoesNotExist) ---
|
||||
try:
|
||||
instance = Candidate.objects.get(pk=pk)
|
||||
except Candidate.DoesNotExist:
|
||||
# Exit gracefully if the candidate was deleted after the task was queued
|
||||
logger.warning(f"Candidate matching query does not exist for pk={pk}. Exiting task.")
|
||||
print(f"Candidate matching query does not exist for pk={pk}. Exiting task.")
|
||||
return
|
||||
|
||||
logger.info(f"Scoring resume for candidate {pk}")
|
||||
print(f"Scoring resume for candidate {pk}")
|
||||
|
||||
# --- 2. I/O and Initial Data Check ---
|
||||
try:
|
||||
file_path = instance.resume.path
|
||||
if not os.path.exists(file_path):
|
||||
logger.warning(f"Resume file not found: {file_path}")
|
||||
print(f"Resume file not found: {file_path}")
|
||||
# Consider marking the task as unsuccessful but don't re-queue
|
||||
return
|
||||
|
||||
resume_text = extract_text_from_pdf(file_path)
|
||||
job_detail= f"{instance.job.description} {instance.job.qualifications}"
|
||||
resume_parser_prompt = f"""
|
||||
You are an expert resume parser and summarizer. Given a resume in plain text format, extract and organize the following key-value information into a clean, valid JSON object:
|
||||
|
||||
full_name: Full name of the candidate
|
||||
current_title: Most recent or current job title
|
||||
location: City and state (or country if outside the U.S.)
|
||||
contact: Phone number and email (as a single string or separate fields)
|
||||
linkedin: LinkedIn profile URL (if present)
|
||||
github: GitHub or portfolio URL (if present)
|
||||
summary: Brief professional profile or summary (1–2 sentences)
|
||||
education: List of degrees, each with:
|
||||
institution
|
||||
degree
|
||||
year
|
||||
gpa (if provided)
|
||||
relevant_courses (as a list, if mentioned)
|
||||
skills: Grouped by category if possible (e.g., programming, big data, visualization), otherwise as a flat list of technologies/tools
|
||||
experience: List of roles, each with:
|
||||
company
|
||||
job_title
|
||||
location
|
||||
start_date and end_date (or "Present" if applicable)
|
||||
key_achievements (as a list of concise bullet points)
|
||||
projects: List of notable projects (if clearly labeled), each with:
|
||||
name
|
||||
year
|
||||
technologies_used
|
||||
brief_description
|
||||
Instructions:
|
||||
|
||||
Be concise but preserve key details.
|
||||
Normalize formatting (e.g., “Jun. 2014” → “2014-06”).
|
||||
Omit redundant or promotional language.
|
||||
If a section is missing, omit the key or set it to null/empty list as appropriate.
|
||||
Output only valid JSON—no markdown, no extra text.
|
||||
Now, process the following resume text:
|
||||
{resume_text}
|
||||
"""
|
||||
resume_parser_result = ai_handler(resume_parser_prompt)
|
||||
resume_scoring_prompt = f"""
|
||||
You are an expert technical recruiter. Your task is to score the following candidate for the role of a Senior Data Analyst based on the provided job criteria.
|
||||
|
||||
**Job Criteria:**
|
||||
{job_detail}
|
||||
|
||||
**Candidate's Extracted Resume Json:**
|
||||
\"\"\"
|
||||
{resume_parser_result}
|
||||
\"\"\"
|
||||
|
||||
**Your Task:**
|
||||
Provide a response in strict JSON format with the following keys:
|
||||
1. 'match_score': A score from 0 to 100 representing how well the candidate fits the role.
|
||||
2. 'strengths': A brief summary of why the candidate is a strong fit, referencing specific criteria.
|
||||
3. 'weaknesses': A brief summary of where the candidate falls short or what criteria are missing.
|
||||
4. 'criteria_checklist': An object where you rate the candidate's match for each specific criterion (e.g., {{'Python': 'Met', 'AWS': 'Not Mentioned'}}).
|
||||
|
||||
|
||||
Only output valid JSON. Do not include any other text.
|
||||
"""
|
||||
|
||||
resume_scoring_result = ai_handler(resume_scoring_prompt)
|
||||
|
||||
instance.parsed_summary = str(resume_parser_result)
|
||||
|
||||
# Update candidate with scoring results
|
||||
instance.match_score = resume_scoring_result.get('match_score')
|
||||
instance.strengths = resume_scoring_result.get('strengths', '')
|
||||
instance.weaknesses = resume_scoring_result.get('weaknesses', '')
|
||||
instance.criteria_checklist = resume_scoring_result.get('criteria_checklist', {})
|
||||
|
||||
instance.is_resume_parsed = True
|
||||
|
||||
# Save only scoring-related fields to avoid recursion
|
||||
instance.save(update_fields=[
|
||||
'match_score', 'strengths', 'weaknesses',
|
||||
'criteria_checklist','parsed_summary', 'is_resume_parsed'
|
||||
])
|
||||
|
||||
logger.info(f"Successfully scored resume for candidate {instance.id}")
|
||||
job_detail = f"{instance.job.description} {instance.job.qualifications}"
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to score resume for candidate {instance.id}: {e}")
|
||||
logger.error(f"Error during initial data retrieval/parsing for candidate {instance.pk}: {e}")
|
||||
print(f"Error during initial data retrieval/parsing for candidate {instance.pk}: {e}")
|
||||
return
|
||||
|
||||
# --- 3. Single, Combined LLM Prompt (Major Cost & Latency Optimization) ---
|
||||
prompt = f"""
|
||||
You are an expert AI system functioning as both a Resume Parser and a Technical Recruiter.
|
||||
|
||||
Your task is to:
|
||||
1. **PARSE**: Extract all key-value information from the provided RESUME TEXT into a clean JSON structure under the key 'parsed_data'.
|
||||
2. **SCORE**: Analyze the parsed data against the JOB CRITERIA and generate a comprehensive score and analysis under the key 'scoring_data'.
|
||||
|
||||
**JOB CRITERIA:**
|
||||
{job_detail}
|
||||
|
||||
**RESUME TEXT:**
|
||||
{resume_text}
|
||||
|
||||
**STRICT JSON OUTPUT INSTRUCTIONS:**
|
||||
Output a single, valid JSON object with ONLY the following two top-level keys:
|
||||
|
||||
1. "parsed_data": {{
|
||||
"full_name": "Full name of the candidate",
|
||||
"current_title": "Most recent or current job title",
|
||||
"location": "City and state",
|
||||
"contact": "Phone number and email",
|
||||
"linkedin": "LinkedIn profile URL",
|
||||
"github": "GitHub or portfolio URL",
|
||||
"summary": "Brief professional profile or summary (1–2 sentences)",
|
||||
"education": [{{
|
||||
"institution": "Institution name",
|
||||
"degree": "Degree name",
|
||||
"year": "Year of graduation",
|
||||
"gpa": "GPA (if provided)",
|
||||
"relevant_courses": ["list", "of", "courses"]
|
||||
}}],
|
||||
"skills": {{
|
||||
"category_1": ["skill_a", "skill_b"],
|
||||
"uncategorized": ["tool_x"]
|
||||
}},
|
||||
"experience": [{{
|
||||
"company": "Company name",
|
||||
"job_title": "Job Title",
|
||||
"location": "Location",
|
||||
"start_date": "YYYY-MM",
|
||||
"end_date": "YYYY-MM or Present",
|
||||
"key_achievements": ["concise", "bullet", "points"]
|
||||
}}],
|
||||
"projects": [{{
|
||||
"name": "Project name",
|
||||
"year": "Year",
|
||||
"technologies_used": ["list", "of", "tech"],
|
||||
"brief_description": "description"
|
||||
}}]
|
||||
}}
|
||||
|
||||
2. "scoring_data": {{
|
||||
"match_score": "Score 0-100",
|
||||
"strengths": "Brief summary of strengths",
|
||||
"weaknesses": "Brief summary of weaknesses",
|
||||
"years_of_experience": "Total years of experience (float, e.g., 6.5)",
|
||||
"criteria_checklist": {{ "Python": "Met", "AWS": "Not Mentioned"}},
|
||||
"category": "Most fitting professional field (e.g., Data Science)",
|
||||
"most_recent_job_title": "Candidate's most recent job title",
|
||||
"recommendation": "Detailed hiring recommendation narrative",
|
||||
"top_3_keywords": ["keyword1", "keyword2", "keyword3"],
|
||||
"job_fit_narrative": "Single, concise summary sentence",
|
||||
"language_fluency": ["language: fluency_level"],
|
||||
"screening_stage_rating": "Standardized rating (e.g., A - Highly Qualified)",
|
||||
"min_req_met_bool": "Boolean (true/false)",
|
||||
"soft_skills_score": "Score 0-100 for inferred non-technical skills",
|
||||
"experience_industry_match": "Score 0-100 for industry relevance"
|
||||
}}
|
||||
|
||||
If a top-level key or its required fields are missing, set the field to null, an empty list, or an empty object as appropriate.
|
||||
|
||||
Output only valid JSON—no markdown, no extra text.
|
||||
"""
|
||||
|
||||
try:
|
||||
result = ai_handler(prompt)
|
||||
if result['status'] == 'error':
|
||||
logger.error(f"AI handler returned error for candidate {instance.pk}")
|
||||
print(f"AI handler returned error for candidate {instance.pk}")
|
||||
return
|
||||
# Ensure the result is parsed as a Python dict (if ai_handler returns a JSON string)
|
||||
data = result['data']
|
||||
if isinstance(data, str):
|
||||
data = json.loads(data)
|
||||
print(data)
|
||||
|
||||
parsed_summary = data.get('parsed_data', {})
|
||||
scoring_result = data.get('scoring_data', {})
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"AI handler failed for candidate {instance.pk}: {e}")
|
||||
print(f"AI handler failed for candidate {instance.pk}: {e}")
|
||||
return
|
||||
|
||||
# --- 4. Atomic Database Update (Ensures data integrity) ---
|
||||
with transaction.atomic():
|
||||
|
||||
# Map JSON keys to model fields with appropriate defaults
|
||||
update_map = {
|
||||
'match_score': ('match_score', 0),
|
||||
'years_of_experience': ('years_of_experience', 0.0),
|
||||
'soft_skills_score': ('soft_skills_score', 0),
|
||||
'experience_industry_match': ('experience_industry_match', 0),
|
||||
|
||||
'min_req_met_bool': ('min_req_met_bool', False),
|
||||
'screening_stage_rating': ('screening_stage_rating', 'N/A'),
|
||||
'most_recent_job_title': ('most_recent_job_title', 'N/A'),
|
||||
'top_3_keywords': ('top_3_keywords', []),
|
||||
|
||||
'strengths': ('strengths', ''),
|
||||
'weaknesses': ('weaknesses', ''),
|
||||
'job_fit_narrative': ('job_fit_narrative', ''),
|
||||
'recommendation': ('recommendation', ''),
|
||||
|
||||
'criteria_checklist': ('criteria_checklist', {}),
|
||||
'language_fluency': ('language_fluency', []),
|
||||
'category': ('category', 'N/A'),
|
||||
}
|
||||
|
||||
# Apply scoring results to the instance
|
||||
for model_field, (json_key, default_value) in update_map.items():
|
||||
instance.ai_analysis_data[model_field] = scoring_result.get(json_key, default_value)
|
||||
# instance.set_field(model_field, scoring_result.get(json_key, default_value))
|
||||
|
||||
# Apply parsing results
|
||||
instance.parsed_summary = json.dumps(parsed_summary)
|
||||
instance.is_resume_parsed = True
|
||||
|
||||
instance.save(update_fields=['ai_analysis_data','parsed_summary', 'is_resume_parsed'])
|
||||
|
||||
logger.info(f"Successfully scored and saved analysis for candidate {instance.id}")
|
||||
print(f"Successfully scored and saved analysis for candidate {instance.id}")
|
||||
|
||||
def create_interview_and_meeting(
|
||||
candidate_id,
|
||||
@ -189,6 +403,8 @@ def create_interview_and_meeting(
|
||||
meeting_id=result["meeting_details"]["meeting_id"],
|
||||
join_url=result["meeting_details"]["join_url"],
|
||||
zoom_gateway_response=result["zoom_gateway_response"],
|
||||
host_email=result["meeting_details"]["host_email"],
|
||||
password=result["meeting_details"]["password"]
|
||||
)
|
||||
ScheduledInterview.objects.create(
|
||||
candidate=candidate,
|
||||
@ -249,8 +465,7 @@ def handle_zoom_webhook_event(payload):
|
||||
meeting_instance.duration = object_data.get('duration', meeting_instance.duration)
|
||||
meeting_instance.timezone = object_data.get('timezone', meeting_instance.timezone)
|
||||
|
||||
# Also update join_url, password, etc., if needed based on the payload structure
|
||||
meeting_instance.status = 'scheduled'
|
||||
meeting_instance.status = object_data.get('status', meeting_instance.status)
|
||||
|
||||
meeting_instance.save(update_fields=['topic', 'start_time', 'duration', 'timezone', 'status'])
|
||||
|
||||
@ -268,9 +483,11 @@ def handle_zoom_webhook_event(payload):
|
||||
# --- 3. Deletion Event (User Action) ---
|
||||
elif event_type == 'meeting.deleted':
|
||||
if meeting_instance:
|
||||
# Mark as cancelled/deleted instead of physically deleting for audit trail
|
||||
meeting_instance.status = 'cancelled'
|
||||
meeting_instance.save(update_fields=['status'])
|
||||
try:
|
||||
meeting_instance.status = 'cancelled'
|
||||
meeting_instance.save(update_fields=['status'])
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to mark Zoom meeting as cancelled: {e}")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Binary file not shown.
@ -1,3 +1,626 @@
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, Client
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from datetime import datetime, time, timedelta
|
||||
import json
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
# Create your tests here.
|
||||
from .models import (
|
||||
JobPosting, Candidate, ZoomMeeting, FormTemplate, FormStage, FormField,
|
||||
FormSubmission, FieldResponse, InterviewSchedule, ScheduledInterview,
|
||||
TrainingMaterial, Source, HiringAgency, Profile, MeetingComment
|
||||
)
|
||||
from .forms import (
|
||||
JobPostingForm, CandidateForm, ZoomMeetingForm, MeetingCommentForm,
|
||||
CandidateStageForm, InterviewScheduleForm
|
||||
)
|
||||
from .views import (
|
||||
ZoomMeetingListView, ZoomMeetingCreateView, job_detail, candidate_screening_view,
|
||||
candidate_exam_view, candidate_interview_view, submit_form, api_schedule_candidate_meeting
|
||||
)
|
||||
from .views_frontend import CandidateListView, JobListView
|
||||
from .utils import create_zoom_meeting, get_candidates_from_request
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
"""Base test case setup with common test data"""
|
||||
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
self.user = User.objects.create_user(
|
||||
username='testuser',
|
||||
email='test@example.com',
|
||||
password='testpass123',
|
||||
is_staff=True
|
||||
)
|
||||
self.profile = Profile.objects.create(user=self.user)
|
||||
|
||||
# Create test data
|
||||
self.job = JobPosting.objects.create(
|
||||
title='Software Engineer',
|
||||
department='IT',
|
||||
job_type='FULL_TIME',
|
||||
workplace_type='REMOTE',
|
||||
location_country='Saudi Arabia',
|
||||
description='Job description',
|
||||
qualifications='Job qualifications',
|
||||
created_by=self.user
|
||||
)
|
||||
|
||||
self.candidate = Candidate.objects.create(
|
||||
first_name='John',
|
||||
last_name='Doe',
|
||||
email='john@example.com',
|
||||
phone='1234567890',
|
||||
resume=SimpleUploadedFile('resume.pdf', b'file_content', content_type='application/pdf'),
|
||||
job=self.job,
|
||||
stage='Applied'
|
||||
)
|
||||
|
||||
self.zoom_meeting = ZoomMeeting.objects.create(
|
||||
topic='Interview with John Doe',
|
||||
start_time=timezone.now() + timedelta(hours=1),
|
||||
duration=60,
|
||||
timezone='UTC',
|
||||
join_url='https://zoom.us/j/123456789',
|
||||
meeting_id='123456789'
|
||||
)
|
||||
|
||||
|
||||
class ModelTests(BaseTestCase):
|
||||
"""Test cases for models"""
|
||||
|
||||
def test_job_posting_creation(self):
|
||||
"""Test JobPosting model creation"""
|
||||
self.assertEqual(self.job.title, 'Software Engineer')
|
||||
self.assertEqual(self.job.department, 'IT')
|
||||
self.assertIsNotNone(self.job.slug)
|
||||
self.assertEqual(self.job.status, 'DRAFT')
|
||||
|
||||
def test_job_posting_unique_id_generation(self):
|
||||
"""Test unique internal job ID generation"""
|
||||
self.assertTrue(self.job.internal_job_id.startswith('KAAUH'))
|
||||
self.assertIn(str(timezone.now().year), self.job.internal_job_id)
|
||||
|
||||
def test_job_posting_methods(self):
|
||||
"""Test JobPosting model methods"""
|
||||
# Test is_expired method
|
||||
self.assertFalse(self.job.is_expired())
|
||||
|
||||
# Test location display
|
||||
self.assertIn('Saudi Arabia', self.job.get_location_display())
|
||||
|
||||
def test_candidate_creation(self):
|
||||
"""Test Candidate model creation"""
|
||||
self.assertEqual(self.candidate.first_name, 'John')
|
||||
self.assertEqual(self.candidate.stage, 'Applied')
|
||||
self.assertEqual(self.candidate.job, self.job)
|
||||
|
||||
def test_candidate_stage_transitions(self):
|
||||
"""Test candidate stage transition logic"""
|
||||
# Test current available stages
|
||||
available_stages = self.candidate.get_available_stages()
|
||||
self.assertIn('Exam', available_stages)
|
||||
self.assertIn('Interview', available_stages)
|
||||
|
||||
def test_zoom_meeting_creation(self):
|
||||
"""Test ZoomMeeting model creation"""
|
||||
self.assertEqual(self.zoom_meeting.topic, 'Interview with John Doe')
|
||||
self.assertEqual(self.zoom_meeting.duration, 60)
|
||||
self.assertIsNotNone(self.zoom_meeting.meeting_id)
|
||||
|
||||
def test_template_creation(self):
|
||||
"""Test FormTemplate model creation"""
|
||||
template = FormTemplate.objects.create(
|
||||
name='Test Template',
|
||||
job=self.job,
|
||||
created_by=self.user
|
||||
)
|
||||
self.assertEqual(template.name, 'Test Template')
|
||||
self.assertEqual(template.job, self.job)
|
||||
|
||||
def test_scheduled_interview_creation(self):
|
||||
"""Test ScheduledInterview model creation"""
|
||||
scheduled = ScheduledInterview.objects.create(
|
||||
candidate=self.candidate,
|
||||
job=self.job,
|
||||
zoom_meeting=self.zoom_meeting,
|
||||
interview_date=timezone.now().date(),
|
||||
interview_time=time(10, 0),
|
||||
status='scheduled'
|
||||
)
|
||||
self.assertEqual(scheduled.candidate, self.candidate)
|
||||
self.assertEqual(scheduled.status, 'scheduled')
|
||||
|
||||
|
||||
class ViewTests(BaseTestCase):
|
||||
"""Test cases for views"""
|
||||
|
||||
def test_job_list_view(self):
|
||||
"""Test JobListView"""
|
||||
response = self.client.get(reverse('job_list'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Software Engineer')
|
||||
|
||||
def test_job_list_search(self):
|
||||
"""Test JobListView search functionality"""
|
||||
response = self.client.get(reverse('job_list'), {'search': 'Software'})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Software Engineer')
|
||||
|
||||
def test_job_detail_view(self):
|
||||
"""Test job_detail view"""
|
||||
response = self.client.get(reverse('job_detail', kwargs={'slug': self.job.slug}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Software Engineer')
|
||||
self.assertContains(response, 'John Doe')
|
||||
|
||||
def test_zoom_meeting_list_view(self):
|
||||
"""Test ZoomMeetingListView"""
|
||||
response = self.client.get(reverse('list_meetings'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Interview with John Doe')
|
||||
|
||||
def test_zoom_meeting_list_search(self):
|
||||
"""Test ZoomMeetingListView search functionality"""
|
||||
response = self.client.get(reverse('list_meetings'), {'q': 'Interview'})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Interview with John Doe')
|
||||
|
||||
def test_zoom_meeting_list_filter_status(self):
|
||||
"""Test ZoomMeetingListView status filter"""
|
||||
response = self.client.get(reverse('list_meetings'), {'status': 'waiting'})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_zoom_meeting_create_view(self):
|
||||
"""Test ZoomMeetingCreateView"""
|
||||
self.client.login(username='testuser', password='testpass123')
|
||||
response = self.client.get(reverse('create_meeting'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_candidate_screening_view(self):
|
||||
"""Test candidate_screening_view"""
|
||||
response = self.client.get(reverse('candidate_screening_view', kwargs={'slug': self.job.slug}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'John Doe')
|
||||
|
||||
def test_candidate_screening_view_filters(self):
|
||||
"""Test candidate_screening_view with filters"""
|
||||
response = self.client.get(
|
||||
reverse('candidate_screening_view', kwargs={'slug': self.job.slug}),
|
||||
{'min_ai_score': '50', 'tier1_count': '5'}
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_candidate_exam_view(self):
|
||||
"""Test candidate_exam_view"""
|
||||
response = self.client.get(reverse('candidate_exam_view', kwargs={'slug': self.job.slug}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'John Doe')
|
||||
|
||||
def test_candidate_interview_view(self):
|
||||
"""Test candidate_interview_view"""
|
||||
response = self.client.get(reverse('candidate_interview_view', kwargs={'slug': self.job.slug}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@patch('recruitment.views.create_zoom_meeting')
|
||||
def test_schedule_candidate_meeting(self, mock_create_zoom):
|
||||
"""Test api_schedule_candidate_meeting view"""
|
||||
mock_create_zoom.return_value = {
|
||||
'status': 'success',
|
||||
'meeting_details': {
|
||||
'meeting_id': '987654321',
|
||||
'join_url': 'https://zoom.us/j/987654321',
|
||||
'password': '123456'
|
||||
},
|
||||
'zoom_gateway_response': {'status': 'waiting'}
|
||||
}
|
||||
|
||||
self.client.login(username='testuser', password='testpass123')
|
||||
data = {
|
||||
'start_time': (timezone.now() + timedelta(hours=2)).isoformat(),
|
||||
'duration': 60
|
||||
}
|
||||
response = self.client.post(
|
||||
reverse('api_schedule_candidate_meeting',
|
||||
kwargs={'job_slug': self.job.slug, 'candidate_pk': self.candidate.pk}),
|
||||
data
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'success')
|
||||
|
||||
def test_submit_form(self):
|
||||
"""Test submit_form view"""
|
||||
# Create a form template first
|
||||
template = FormTemplate.objects.create(
|
||||
job=self.job,
|
||||
name='Test Template',
|
||||
created_by=self.user,
|
||||
is_active=True
|
||||
)
|
||||
|
||||
data = {
|
||||
'field_1': 'John', # Assuming field ID 1 corresponds to First Name
|
||||
'field_2': 'Doe', # Assuming field ID 2 corresponds to Last Name
|
||||
'field_3': 'john@example.com', # Email
|
||||
}
|
||||
|
||||
response = self.client.post(
|
||||
reverse('submit_form', kwargs={'template_id': template.id}),
|
||||
data
|
||||
)
|
||||
# After successful submission, should redirect to success page
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class FormTests(BaseTestCase):
|
||||
"""Test cases for forms"""
|
||||
|
||||
def test_job_posting_form(self):
|
||||
"""Test JobPostingForm"""
|
||||
form_data = {
|
||||
'title': 'New Job Title',
|
||||
'department': 'New Department',
|
||||
'job_type': 'FULL_TIME',
|
||||
'workplace_type': 'REMOTE',
|
||||
'location_city': 'Riyadh',
|
||||
'location_state': 'Riyadh',
|
||||
'location_country': 'Saudi Arabia',
|
||||
'description': 'Job description',
|
||||
'qualifications': 'Job qualifications',
|
||||
'salary_range': '5000-7000',
|
||||
'application_deadline': '2025-12-31',
|
||||
'max_applications': '100',
|
||||
'open_positions': '2',
|
||||
'hash_tags': '#hiring, #jobopening'
|
||||
}
|
||||
form = JobPostingForm(data=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_candidate_form(self):
|
||||
"""Test CandidateForm"""
|
||||
form_data = {
|
||||
'job': self.job.id,
|
||||
'first_name': 'Jane',
|
||||
'last_name': 'Smith',
|
||||
'phone': '9876543210',
|
||||
'email': 'jane@example.com',
|
||||
'resume': SimpleUploadedFile('resume.pdf', b'file_content', content_type='application/pdf')
|
||||
}
|
||||
form = CandidateForm(data=form_data, files=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_zoom_meeting_form(self):
|
||||
"""Test ZoomMeetingForm"""
|
||||
form_data = {
|
||||
'topic': 'Test Meeting',
|
||||
'start_time': (timezone.now() + timedelta(hours=1)).strftime('%Y-%m-%dT%H:%M'),
|
||||
'duration': 60
|
||||
}
|
||||
form = ZoomMeetingForm(data=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_meeting_comment_form(self):
|
||||
"""Test MeetingCommentForm"""
|
||||
form_data = {
|
||||
'content': 'This is a test comment'
|
||||
}
|
||||
form = MeetingCommentForm(data=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_candidate_stage_form(self):
|
||||
"""Test CandidateStageForm with valid transition"""
|
||||
form_data = {
|
||||
'stage': 'Exam'
|
||||
}
|
||||
form = CandidateStageForm(data=form_data, candidate=self.candidate)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_interview_schedule_form(self):
|
||||
"""Test InterviewScheduleForm"""
|
||||
form_data = {
|
||||
'candidates': [self.candidate.id],
|
||||
'start_date': (timezone.now() + timedelta(days=1)).date(),
|
||||
'end_date': (timezone.now() + timedelta(days=7)).date(),
|
||||
'working_days': [0, 1, 2, 3, 4], # Monday to Friday
|
||||
'start_time': '09:00',
|
||||
'end_time': '17:00',
|
||||
'interview_duration': 60,
|
||||
'buffer_time': 15
|
||||
}
|
||||
form = InterviewScheduleForm(slug=self.job.slug, data=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
|
||||
class IntegrationTests(BaseTestCase):
|
||||
"""Integration tests for multiple components"""
|
||||
|
||||
def test_candidate_journey(self):
|
||||
"""Test the complete candidate journey from application to interview"""
|
||||
# 1. Create candidate
|
||||
candidate = Candidate.objects.create(
|
||||
first_name='Jane',
|
||||
last_name='Smith',
|
||||
email='jane@example.com',
|
||||
phone='9876543210',
|
||||
resume=SimpleUploadedFile('resume.pdf', b'file_content', content_type='application/pdf'),
|
||||
job=self.job,
|
||||
stage='Applied'
|
||||
)
|
||||
|
||||
# 2. Move to Exam stage
|
||||
candidate.stage = 'Exam'
|
||||
candidate.save()
|
||||
|
||||
# 3. Move to Interview stage
|
||||
candidate.stage = 'Interview'
|
||||
candidate.save()
|
||||
|
||||
# 4. Create interview schedule
|
||||
scheduled_interview = ScheduledInterview.objects.create(
|
||||
candidate=candidate,
|
||||
job=self.job,
|
||||
zoom_meeting=self.zoom_meeting,
|
||||
interview_date=timezone.now().date(),
|
||||
interview_time=time(10, 0),
|
||||
status='scheduled'
|
||||
)
|
||||
|
||||
# 5. Verify all stages and relationships
|
||||
self.assertEqual(Candidate.objects.count(), 2)
|
||||
self.assertEqual(ScheduledInterview.objects.count(), 1)
|
||||
self.assertEqual(candidate.stage, 'Interview')
|
||||
self.assertEqual(scheduled_interview.candidate, candidate)
|
||||
|
||||
def test_meeting_candidate_association(self):
|
||||
"""Test the association between meetings and candidates"""
|
||||
# Create a scheduled interview
|
||||
scheduled_interview = ScheduledInterview.objects.create(
|
||||
candidate=self.candidate,
|
||||
job=self.job,
|
||||
zoom_meeting=self.zoom_meeting,
|
||||
interview_date=timezone.now().date(),
|
||||
interview_time=time(10, 0),
|
||||
status='scheduled'
|
||||
)
|
||||
|
||||
# Verify the relationship
|
||||
self.assertEqual(self.zoom_meeting.interview, scheduled_interview)
|
||||
self.assertEqual(self.candidate.get_meetings().count(), 1)
|
||||
|
||||
def test_form_submission_candidate_creation(self):
|
||||
"""Test creating a candidate through form submission"""
|
||||
# Create a form template
|
||||
template = FormTemplate.objects.create(
|
||||
job=self.job,
|
||||
name='Application Form',
|
||||
created_by=self.user,
|
||||
is_active=True
|
||||
)
|
||||
|
||||
# Create form stages and fields
|
||||
stage = FormStage.objects.create(
|
||||
template=template,
|
||||
name='Personal Information',
|
||||
order=0
|
||||
)
|
||||
|
||||
FormField.objects.create(
|
||||
stage=stage,
|
||||
label='First Name',
|
||||
field_type='text',
|
||||
order=0
|
||||
)
|
||||
FormField.objects.create(
|
||||
stage=stage,
|
||||
label='Last Name',
|
||||
field_type='text',
|
||||
order=1
|
||||
)
|
||||
FormField.objects.create(
|
||||
stage=stage,
|
||||
label='Email',
|
||||
field_type='email',
|
||||
order=2
|
||||
)
|
||||
|
||||
# Submit form data
|
||||
form_data = {
|
||||
'field_1': 'New',
|
||||
'field_2': 'Candidate',
|
||||
'field_3': 'new@example.com'
|
||||
}
|
||||
|
||||
response = self.client.post(
|
||||
reverse('submit_form', kwargs={'template_id': template.id}),
|
||||
form_data
|
||||
)
|
||||
|
||||
# Verify candidate was created
|
||||
self.assertEqual(Candidate.objects.filter(email='new@example.com').count(), 1)
|
||||
|
||||
|
||||
class PerformanceTests(BaseTestCase):
|
||||
"""Basic performance tests"""
|
||||
|
||||
def test_large_dataset_pagination(self):
|
||||
"""Test pagination with large datasets"""
|
||||
# Create many candidates
|
||||
for i in range(100):
|
||||
Candidate.objects.create(
|
||||
first_name=f'Candidate{i}',
|
||||
last_name=f'Test{i}',
|
||||
email=f'candidate{i}@example.com',
|
||||
phone=f'123456789{i}',
|
||||
job=self.job,
|
||||
stage='Applied'
|
||||
)
|
||||
|
||||
# Test pagination
|
||||
response = self.client.get(reverse('candidate_list'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Candidate')
|
||||
|
||||
|
||||
class AuthenticationTests(BaseTestCase):
|
||||
"""Authentication and permission tests"""
|
||||
|
||||
def test_unauthorized_access(self):
|
||||
"""Test that unauthorized users cannot access protected views"""
|
||||
# Create a non-staff user
|
||||
regular_user = User.objects.create_user(
|
||||
username='regularuser',
|
||||
email='regular@example.com',
|
||||
password='testpass123'
|
||||
)
|
||||
|
||||
# Try to access a view that requires staff privileges
|
||||
self.client.login(username='regularuser', password='testpass123')
|
||||
response = self.client.get(reverse('job_list'))
|
||||
# Should still be accessible for now (can be adjusted based on actual requirements)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_login_required(self):
|
||||
"""Test that login is required for certain operations"""
|
||||
# Test form submission without login
|
||||
template = FormTemplate.objects.create(
|
||||
job=self.job,
|
||||
name='Test Template',
|
||||
created_by=self.user,
|
||||
is_active=True
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
reverse('submit_form', kwargs={'template_id': template.id}),
|
||||
{}
|
||||
)
|
||||
# Should redirect to login page
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class EdgeCaseTests(BaseTestCase):
|
||||
"""Tests for edge cases and error handling"""
|
||||
|
||||
def test_invalid_job_id(self):
|
||||
"""Test handling of invalid job slug"""
|
||||
response = self.client.get(reverse('job_detail', kwargs={'slug': 'invalid-slug'}))
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
def test_meeting_past_time(self):
|
||||
"""Test handling of meeting with past time"""
|
||||
# This would be tested in the view that validates meeting time
|
||||
pass
|
||||
|
||||
def test_duplicate_submission(self):
|
||||
"""Test handling of duplicate form submissions"""
|
||||
# Create form template
|
||||
template = FormTemplate.objects.create(
|
||||
job=self.job,
|
||||
name='Test Template',
|
||||
created_by=self.user,
|
||||
is_active=True
|
||||
)
|
||||
|
||||
# Submit form twice
|
||||
response1 = self.client.post(
|
||||
reverse('submit_form', kwargs={'template_id': template.id}),
|
||||
{'field_1': 'John', 'field_2': 'Doe'}
|
||||
)
|
||||
|
||||
# This should be handled by the view logic
|
||||
# Currently, it would create a duplicate candidate
|
||||
# We can add validation to prevent this if needed
|
||||
|
||||
def test_invalid_stage_transition(self):
|
||||
"""Test invalid candidate stage transitions"""
|
||||
# Try to transition from Interview back to Applied (should be invalid)
|
||||
self.candidate.stage = 'Interview'
|
||||
self.candidate.save()
|
||||
|
||||
# The model should prevent this through validation
|
||||
# This would be tested in the model's clean method or view logic
|
||||
pass
|
||||
|
||||
|
||||
class UtilityFunctionTests(BaseTestCase):
|
||||
"""Tests for utility functions"""
|
||||
|
||||
@patch('recruitment.views.create_zoom_meeting')
|
||||
def test_create_zoom_meeting_utility(self, mock_create):
|
||||
"""Test the create_zoom_meeting utility function"""
|
||||
mock_create.return_value = {
|
||||
'status': 'success',
|
||||
'meeting_details': {
|
||||
'meeting_id': '123456789',
|
||||
'join_url': 'https://zoom.us/j/123456789'
|
||||
}
|
||||
}
|
||||
|
||||
result = create_zoom_meeting(
|
||||
topic='Test Meeting',
|
||||
start_time=timezone.now() + timedelta(hours=1),
|
||||
duration=60
|
||||
)
|
||||
|
||||
self.assertEqual(result['status'], 'success')
|
||||
self.assertIn('meeting_id', result['meeting_details'])
|
||||
|
||||
def test_get_candidates_from_request(self):
|
||||
"""Test the get_candidates_from_request utility function"""
|
||||
# This would be tested with a request that has candidate_ids
|
||||
pass
|
||||
|
||||
|
||||
# Factory classes for test data (can be expanded with factory_boy)
|
||||
class TestFactories:
|
||||
"""Factory methods for creating test data"""
|
||||
|
||||
@staticmethod
|
||||
def create_job_posting(**kwargs):
|
||||
defaults = {
|
||||
'title': 'Test Job',
|
||||
'department': 'Test Department',
|
||||
'job_type': 'FULL_TIME',
|
||||
'workplace_type': 'ON_SITE',
|
||||
'location_country': 'Saudi Arabia',
|
||||
'description': 'Test description',
|
||||
'created_by': User.objects.create_user('factoryuser', 'factory@example.com', 'password')
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return JobPosting.objects.create(**defaults)
|
||||
|
||||
@staticmethod
|
||||
def create_candidate(**kwargs):
|
||||
job = TestFactories.create_job_posting()
|
||||
defaults = {
|
||||
'first_name': 'Test',
|
||||
'last_name': 'Candidate',
|
||||
'email': 'test@example.com',
|
||||
'phone': '1234567890',
|
||||
'job': job,
|
||||
'stage': 'Applied'
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return Candidate.objects.create(**defaults)
|
||||
|
||||
@staticmethod
|
||||
def create_zoom_meeting(**kwargs):
|
||||
defaults = {
|
||||
'topic': 'Test Meeting',
|
||||
'start_time': timezone.now() + timedelta(hours=1),
|
||||
'duration': 60,
|
||||
'timezone': 'UTC',
|
||||
'join_url': 'https://zoom.us/j/test123',
|
||||
'meeting_id': 'test123'
|
||||
}
|
||||
defaults.update(kwargs)
|
||||
return ZoomMeeting.objects.create(**defaults)
|
||||
|
||||
|
||||
# Test runner configuration (can be added to settings)
|
||||
"""
|
||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
TEST_DISCOVER_TOPS = ['recruitment']
|
||||
"""
|
||||
|
||||
1078
recruitment/tests_advanced.py
Normal file
1078
recruitment/tests_advanced.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ from . import views
|
||||
from . import views_integration
|
||||
|
||||
urlpatterns = [
|
||||
path('dashboard/', views_frontend.dashboard_view, name='dashboard'),
|
||||
path('', views_frontend.dashboard_view, name='dashboard'),
|
||||
|
||||
# Job URLs (using JobPosting model)
|
||||
path('jobs/', views_frontend.JobListView.as_view(), name='job_list'),
|
||||
@ -68,6 +68,8 @@ urlpatterns = [
|
||||
path('jobs/<slug:slug>/candidate_screening_view/', views.candidate_screening_view, name='candidate_screening_view'),
|
||||
path('jobs/<slug:slug>/candidate_exam_view/', views.candidate_exam_view, name='candidate_exam_view'),
|
||||
path('jobs/<slug:slug>/candidate_interview_view/', views.candidate_interview_view, name='candidate_interview_view'),
|
||||
path('jobs/<slug:slug>/candidate_offer_view/', views_frontend.candidate_offer_view, name='candidate_offer_view'),
|
||||
path('jobs/<slug:job_slug>/candidates/<slug:candidate_slug>/update_status/<str:stage_type>/<str:status>/', views_frontend.update_candidate_status, name='update_candidate_status'),
|
||||
|
||||
path('jobs/<slug:slug>/<int:candidate_id>/reschedule_meeting_for_candidate/<int:meeting_id>/', views.reschedule_meeting_for_candidate, name='reschedule_meeting_for_candidate'),
|
||||
|
||||
@ -108,4 +110,11 @@ urlpatterns = [
|
||||
|
||||
# users urls
|
||||
path('user/<int:pk>',views.user_detail,name='user_detail'),
|
||||
|
||||
# Meeting Comments URLs
|
||||
path('meetings/<slug:slug>/comments/add/', views.add_meeting_comment, name='add_meeting_comment'),
|
||||
path('meetings/<slug:slug>/comments/<int:comment_id>/edit/', views.edit_meeting_comment, name='edit_meeting_comment'),
|
||||
path('meetings/<slug:slug>/comments/<int:comment_id>/delete/', views.delete_meeting_comment, name='delete_meeting_comment'),
|
||||
|
||||
path('meetings/<slug:slug>/set_meeting_candidate/', views.set_meeting_candidate, name='set_meeting_candidate'),
|
||||
]
|
||||
|
||||
1140
recruitment/views.py
1140
recruitment/views.py
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,8 @@ from django.contrib.messages.views import SuccessMessageMixin
|
||||
from django.views.generic import ListView, CreateView, UpdateView, DeleteView, DetailView
|
||||
# JobForm removed - using JobPostingForm instead
|
||||
from django.urls import reverse_lazy
|
||||
from django.db.models import Q
|
||||
from django.db.models import Q, Count, Avg
|
||||
from django.db.models import FloatField
|
||||
|
||||
from datastar_py.django import (
|
||||
DatastarResponse,
|
||||
@ -224,6 +225,7 @@ def training_list(request):
|
||||
return render(request, 'recruitment/training_list.html', {'materials': materials})
|
||||
|
||||
|
||||
@login_required
|
||||
def candidate_detail(request, slug):
|
||||
from rich.json import JSON
|
||||
candidate = get_object_or_404(models.Candidate, slug=slug)
|
||||
@ -235,7 +237,7 @@ def candidate_detail(request, slug):
|
||||
# Create stage update form for staff users
|
||||
stage_form = None
|
||||
if request.user.is_staff:
|
||||
stage_form = forms.CandidateStageForm(candidate=candidate)
|
||||
stage_form = forms.CandidateStageForm()
|
||||
|
||||
# parsed = JSON(json.dumps(parsed), indent=2, highlight=True, skip_keys=False, ensure_ascii=False, check_circular=True, allow_nan=True, default=None, sort_keys=False)
|
||||
# parsed = json_to_markdown_table([parsed])
|
||||
@ -245,10 +247,11 @@ def candidate_detail(request, slug):
|
||||
'stage_form': stage_form,
|
||||
})
|
||||
|
||||
@login_required
|
||||
def candidate_update_stage(request, slug):
|
||||
"""Handle HTMX stage update requests"""
|
||||
candidate = get_object_or_404(models.Candidate, slug=slug)
|
||||
form = forms.CandidateStageForm(request.POST, candidate=candidate)
|
||||
form = forms.CandidateStageForm(request.POST, instance=candidate)
|
||||
if form.is_valid():
|
||||
stage_value = form.cleaned_data['stage']
|
||||
candidate.stage = stage_value
|
||||
@ -318,6 +321,7 @@ class TrainingDeleteView(LoginRequiredMixin, SuccessMessageMixin, DeleteView):
|
||||
success_message = 'Training material deleted successfully.'
|
||||
|
||||
|
||||
@login_required
|
||||
def dashboard_view(request):
|
||||
total_jobs = models.JobPosting.objects.count()
|
||||
total_candidates = models.Candidate.objects.count()
|
||||
@ -335,3 +339,79 @@ def dashboard_view(request):
|
||||
'average_applications': average_applications,
|
||||
}
|
||||
return render(request, 'recruitment/dashboard.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
def candidate_offer_view(request, slug):
|
||||
"""View for candidates in the Offer stage"""
|
||||
job = get_object_or_404(models.JobPosting, slug=slug)
|
||||
|
||||
# Filter candidates for this specific job and stage
|
||||
candidates = job.offer_candidates
|
||||
|
||||
# Handle search
|
||||
search_query = request.GET.get('search', '')
|
||||
if search_query:
|
||||
candidates = candidates.filter(
|
||||
Q(first_name__icontains=search_query) |
|
||||
Q(last_name__icontains=search_query) |
|
||||
Q(email__icontains=search_query) |
|
||||
Q(phone__icontains=search_query)
|
||||
)
|
||||
|
||||
candidates = candidates.order_by('-created_at')
|
||||
|
||||
context = {
|
||||
'job': job,
|
||||
'candidates': candidates,
|
||||
'search_query': search_query,
|
||||
'current_stage': 'Offer',
|
||||
}
|
||||
return render(request, 'recruitment/candidate_offer_view.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
def update_candidate_status(request, job_slug, candidate_slug, stage_type, status):
|
||||
"""Handle exam/interview/offer status updates"""
|
||||
from django.utils import timezone
|
||||
|
||||
job = get_object_or_404(models.JobPosting, slug=job_slug)
|
||||
candidate = get_object_or_404(models.Candidate, slug=candidate_slug, job=job)
|
||||
print(stage_type,status)
|
||||
|
||||
if request.method == "POST":
|
||||
if stage_type == 'exam':
|
||||
candidate.exam_status = status
|
||||
candidate.exam_date = timezone.now()
|
||||
candidate.save(update_fields=['exam_status', 'exam_date'])
|
||||
elif stage_type == 'interview':
|
||||
candidate.interview_status = status
|
||||
candidate.interview_date = timezone.now()
|
||||
candidate.save(update_fields=['interview_status', 'interview_date'])
|
||||
elif stage_type == 'offer':
|
||||
candidate.offer_status = status
|
||||
candidate.offer_date = timezone.now()
|
||||
candidate.save(update_fields=['offer_status', 'offer_date'])
|
||||
messages.success(request, f"Candidate {status} successfully!")
|
||||
else:
|
||||
messages.error(request, "No changes made.")
|
||||
|
||||
if stage_type == 'exam':
|
||||
return redirect('candidate_exam_view', job.slug)
|
||||
elif stage_type == 'interview':
|
||||
return redirect('candidate_interview_view', job.slug)
|
||||
elif stage_type == 'offer':
|
||||
return redirect('candidate_offer_view', job.slug)
|
||||
|
||||
return redirect('candidate_detail', candidate.slug)
|
||||
else:
|
||||
if stage_type == 'exam':
|
||||
return render(request,"includes/candidate_update_exam_form.html",{'candidate':candidate,'job':job})
|
||||
elif stage_type == 'interview':
|
||||
return render(request,"includes/candidate_update_interview_form.html",{'candidate':candidate,'job':job})
|
||||
elif stage_type == 'offer':
|
||||
return render(request,"includes/candidate_update_offer_form.html",{'candidate':candidate,'job':job})
|
||||
|
||||
|
||||
# Removed incorrect JobDetailView class.
|
||||
# The job_detail view is handled by function-based view in recruitment.views
|
||||
|
||||
6
run.py
6
run.py
@ -37,4 +37,8 @@ if __name__ == "__main__":
|
||||
duration = 60
|
||||
host_email = "your_zoom_email"
|
||||
response = create_zoom_meeting(topic, start_time, duration, host_email)
|
||||
print(response.json())
|
||||
print(response.json())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
template_partials/__init__.py
Normal file
1
template_partials/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# Template partials app
|
||||
7
template_partials/apps.py
Normal file
7
template_partials/apps.py
Normal file
@ -0,0 +1,7 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class TemplatePartialsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'template_partials'
|
||||
verbose_name = 'Template Partials'
|
||||
@ -1,5 +1,5 @@
|
||||
{% load i18n static %}
|
||||
{% load partials %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_CODE == 'ar' %}rtl{% else %}ltr{% endif %}">
|
||||
<head>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static i18n form_filters %}
|
||||
{% load partials %}
|
||||
|
||||
|
||||
{% block title %}All Submissions for {{ template.name }} - ATS{% endblock %}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static i18n crispy_forms_tags %}
|
||||
{% load partials %}
|
||||
|
||||
|
||||
{% block title %}Submissions for {{ template.name }} - ATS{% endblock %}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static i18n crispy_forms_tags %}
|
||||
{% load partials %}
|
||||
|
||||
|
||||
{% block title %}Form Templates - {{ block.super }}{% endblock %}
|
||||
|
||||
@ -76,13 +76,13 @@
|
||||
transform: none;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
|
||||
}
|
||||
|
||||
|
||||
/* Card Header (For Search/Filter Card) */
|
||||
.card-header {
|
||||
font-weight: 600;
|
||||
padding: 1.25rem;
|
||||
border-bottom: 1px solid var(--kaauh-border);
|
||||
background-color: var(--kaauh-gray-light);
|
||||
background-color: var(--kaauh-gray-light);
|
||||
}
|
||||
|
||||
/* Stats Theming */
|
||||
@ -205,7 +205,7 @@
|
||||
<span class="text-muted small mb-3">
|
||||
<i class="fas fa-briefcase me-1"></i> {{ template.job|default:"N/A" }}
|
||||
</span>
|
||||
|
||||
|
||||
{# Stats #}
|
||||
<div class="row text-center mb-3">
|
||||
<div class="col-6 border-end">
|
||||
@ -217,7 +217,7 @@
|
||||
<div class="stat-label">{% trans "Fields" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{# Description #}
|
||||
<p class="card-text small text-muted flex-grow-1">
|
||||
{% if template.description %}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg class="size-2 heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 330 B After Width: | Height: | Size: 337 B |
@ -1,25 +1,31 @@
|
||||
{% load i18n %}
|
||||
<h5 class="modal-title" id="candidateviewModalLabel">{{ candidate.name }} - {% trans "Score" %}: <span class="badge bg-success"> {{ candidate.match_score }} </span></h5>
|
||||
<h5> {% trans "AI Score" %}: <span class="badge bg-success"><i class="fas fa-robot me-1"></i> {{ candidate.match_score }}</span> <span class="badge bg-success"><i class="fas fa-graduation-cap me-1"></i> {{ candidate.professional_category }} </span></h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{% trans "Strengths" %}</label>
|
||||
<textarea class="form-control" rows="3" readonly>{{ candidate.strengths }}</textarea>
|
||||
<label class="form-label"><i class="fas fa-comment me-1 text-info"></i> {% trans "Recommendation" %}</label>
|
||||
<textarea class="form-control" rows="10" readonly>{{ candidate.recommendation }}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{% trans "Weaknesses" %}</label>
|
||||
<textarea class="form-control" rows="3" readonly>{{ candidate.weaknesses }}</textarea>
|
||||
<label class="form-label"><i class="fas fa-thumbs-up me-1 text-success"></i> {% trans "Strengths" %}</label>
|
||||
<textarea class="form-control" rows="6" readonly>{{ candidate.strengths }}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">{% trans "Criteria Checklist" %}</label>
|
||||
<label class="form-label"><i class="fas fa-thumbs-down me-1 text-danger"></i> {% trans "Weaknesses" %}</label>
|
||||
<textarea class="form-control" rows="6" readonly>{{ candidate.weaknesses }}</textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><i class="fas fa-list-check me-1"></i> {% trans "Criteria Checklist" %}</label>
|
||||
<ul class="list-group">
|
||||
{% for key, value in candidate.criteria_checklist.items %}
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span>{{ key }}</span>
|
||||
<span class="fw-" style="font-size: smaller;">{{ key }}</span>
|
||||
{% if value == 'Met' %}
|
||||
<span class="badge bg-success">Yes</span>
|
||||
<span class="badge bg-success"><i class="fas fa-check me-1"></i> Yes</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">Not Mentioned</span>
|
||||
<span class="badge bg-danger"><i class="fas fa-times me-1"></i> Not Mentioned</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
10
templates/includes/candidate_update_exam_form.html
Normal file
10
templates/includes/candidate_update_exam_form.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% load i18n %}
|
||||
<div class="d-flex justify-content-center align-items-center gap-2" hx-swap='outerHTML' hx-select=".table-responsive" hx-target=".table-responsive"
|
||||
hx-on::after-request="const modal = bootstrap.Modal.getInstance(document.getElementById('candidateviewModal')); if (modal) { modal.hide(); }">
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'exam' 'Passed' %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-check me-1"></i> {% trans "Passed" %}
|
||||
</a>
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'exam' 'Failed' %}" class="btn btn-danger">
|
||||
<i class="fas fa-times me-1"></i> {% trans "Failed" %}
|
||||
</a>
|
||||
</div>
|
||||
10
templates/includes/candidate_update_interview_form.html
Normal file
10
templates/includes/candidate_update_interview_form.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% load i18n %}
|
||||
<div class="d-flex justify-content-center align-items-center gap-2" hx-swap='outerHTML' hx-select=".table-responsive" hx-target=".table-responsive"
|
||||
hx-on::after-request="const modal = bootstrap.Modal.getInstance(document.getElementById('candidateviewModal')); if (modal) { modal.hide(); }">
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'interview' 'Passed' %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-check me-1"></i> {% trans "Passed" %}
|
||||
</a>
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'interview' 'Failed' %}" class="btn btn-danger">
|
||||
<i class="fas fa-times me-1"></i> {% trans "Failed" %}
|
||||
</a>
|
||||
</div>
|
||||
10
templates/includes/candidate_update_offer_form.html
Normal file
10
templates/includes/candidate_update_offer_form.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% load i18n %}
|
||||
<div class="d-flex justify-content-center align-items-center gap-2" hx-swap='outerHTML' hx-select=".table-responsive" hx-target=".table-responsive"
|
||||
hx-on::after-request="const modal = bootstrap.Modal.getInstance(document.getElementById('candidateviewModal')); if (modal) { modal.hide(); }">
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'offer' 'Accepted' %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-check me-1"></i> {% trans "Accepted" %}
|
||||
</a>
|
||||
<a hx-post="{% url 'update_candidate_status' job.slug candidate.slug 'offer' 'Rejected' %}" class="btn btn-danger">
|
||||
<i class="fas fa-times me-1"></i> {% trans "Rejected" %}
|
||||
</a>
|
||||
</div>
|
||||
24
templates/includes/comment_form.html
Normal file
24
templates/includes/comment_form.html
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="card mt-4">
|
||||
<div class="card-header text-primary-theme">
|
||||
<h5 class="card-title mb-0">Add Comment</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{% url 'add_meeting_comment' meeting.slug %}">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
{{ form.content }}
|
||||
{% if form.content.errors %}
|
||||
<div class="text-danger mt-1">
|
||||
{% for error in form.content.errors %}
|
||||
<small>{{ error }}</small>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Add Comment</button>
|
||||
{% if 'HX-Request' in request.headers %}
|
||||
<button type="button" class="btn btn-secondary" hx-get="{% url 'meeting_details' meeting.slug %}" hx-target="#comment-section">Cancel</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
56
templates/includes/comment_list.html
Normal file
56
templates/includes/comment_list.html
Normal file
@ -0,0 +1,56 @@
|
||||
<div id="comment-section">
|
||||
<div class="card mt-4">
|
||||
<div class="card-header text-primary-theme d-flex justify-content-between align-items-center">
|
||||
<h5 class="card-title mb-0">Comments ({{ comments.count }})</h5>
|
||||
{% if 'HX-Request' in request.headers %}
|
||||
<button type="button" class="btn btn-light btn-sm" hx-get="{% url 'meeting_details' meeting.slug %}" hx-target="#comment-section">
|
||||
<i class="bi bi-x-lg"></i> Close
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if comments %}
|
||||
<div class="row">
|
||||
{% for comment in comments %}
|
||||
<div class="col-12 mb-3">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-start ">
|
||||
<div>
|
||||
<strong>{{ comment.author.get_full_name|default:comment.author.username }}</strong>
|
||||
{% if comment.author != user %}
|
||||
<span class="badge bg-secondary ms-2">Comment</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">{{ comment.created_at|date:"M d, Y P" }}</small>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">{{ comment.content|safe }}</p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
{% if comment.author == user or user.is_staff %}
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
hx-get="{% url 'edit_meeting_comment' meeting.slug comment.id %}"
|
||||
hx-target="#comment-section"
|
||||
title="Edit Comment">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger"
|
||||
hx-get="{% url 'delete_meeting_comment' meeting.slug comment.id %}"
|
||||
hx-target="#comment-section"
|
||||
title="Delete Comment">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted">No comments yet. Be the first to comment!</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
16
templates/includes/delete_comment_form.html
Normal file
16
templates/includes/delete_comment_form.html
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="card mt-4">
|
||||
<div class="card-header text-primary-theme">
|
||||
<h5 class="card-title mb-0">Delete Comment</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>Are you sure you want to delete this comment by <strong>{{ comment.author.get_full_name|default:comment.author.username }}</strong>?</p>
|
||||
<p><small>{{ comment.created_at|date:"F d, Y P" }}</small></p>
|
||||
<form method="post" action="{{ delete_url }}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-danger">Yes, Delete</button>
|
||||
{% if 'HX-Request' in request.headers %}
|
||||
<button type="button" class="btn btn-secondary" hx-get="{% url 'meeting_details' meeting.slug %}" hx-target="#comment-section">Cancel</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,32 +1,18 @@
|
||||
{% load i18n %}
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="meetingModal" tabindex="-1" aria-labelledby="meetingModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteModalLabel">
|
||||
<svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
{% trans "Confirm Delete" %}
|
||||
<h5 class="modal-title" id="meetingModalLabel">
|
||||
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="deleteModalMessage">{% trans "Are you sure you want to delete this item?" %}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||
<form id="deleteForm" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-danger">
|
||||
<svg class="heroicon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
{% trans "Delete" %}
|
||||
</button>
|
||||
</form>
|
||||
<div id="meetingModalBody" class="modal-body px-4 py-3">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
24
templates/includes/edit_comment_form.html
Normal file
24
templates/includes/edit_comment_form.html
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="card mt-4">
|
||||
<div class="card-header text-primary-theme">
|
||||
<h5 class="card-title mb-0">Edit Comment</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{% url 'edit_meeting_comment' meeting.slug comment.id %}">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
{{ form.content }}
|
||||
{% if form.content.errors %}
|
||||
<div class="text-danger mt-1">
|
||||
{% for error in form.content.errors %}
|
||||
<small>{{ error }}</small>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<button type="submit" class="btn bg-primary-theme btn-sm text-white">Update Comment</button>
|
||||
{% if 'HX-Request' in request.headers %}
|
||||
<button type="button" class="btn btn-secondary btn-sm" hx-get="{% url 'meeting_details' meeting.slug %}" hx-target="#comment-section">Cancel</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -3,23 +3,23 @@
|
||||
<ul class="pagination justify-content-center">
|
||||
{% if page_obj.has_previous %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page=1{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">First</a>
|
||||
<a class="page-link text-primary-theme" href="?page=1{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">First</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Previous</a>
|
||||
<a class="page-link text-primary-theme" href="?page={{ page_obj.previous_page_number }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="page-item active">
|
||||
<span class="page-link">{{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
|
||||
<li class="page-item">
|
||||
<span class="page-link bg-primary-theme text-white">{{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
|
||||
</li>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Next</a>
|
||||
<a class="page-link text-primary-theme" href="?page={{ page_obj.next_page_number }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Next</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Last</a>
|
||||
<a class="page-link text-primary-theme" href="?page={{ page_obj.paginator.num_pages }}{% if search_query %}&q={{ search_query }}{% endif %}{% if job_filter %}&job={{ job_filter }}{% endif %}">Last</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
</svg>
|
||||
</span>
|
||||
<input type="text" name="search"
|
||||
class="form-control-sm border-start-0"
|
||||
placeholder="{% trans 'Search...' %}"
|
||||
value="{{ search_query }}"
|
||||
aria-label="{% trans 'Search' %}">
|
||||
class="form-control border-start-0"
|
||||
placeholder="{% trans 'Search...' %}"
|
||||
value="{{ search_query }}"
|
||||
aria-label="{% trans 'Search' %}">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
--color-canceled: #dc3545; /* Red for Negative/Canceled */
|
||||
--color-line-default: #e9ecef; /* Light Gray for all inactive markers */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Primary Color Overrides */
|
||||
.text-primary { color: var(--kaauh-teal) !important; }
|
||||
@ -175,15 +175,11 @@
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'dashboard' %}" class="text-secondary">Home</a></li>
|
||||
@ -283,13 +279,12 @@
|
||||
<div class="col-md-6">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-main-action"
|
||||
class="btn btn-main-action btn-sm"
|
||||
id="copyJobLinkButton"
|
||||
data-url="{{ job.application_url }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 heroicon">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z" />
|
||||
</svg>
|
||||
|
||||
{% trans "Share Public Link" %}
|
||||
</button>
|
||||
|
||||
@ -384,6 +379,22 @@
|
||||
|
||||
{# RIGHT COLUMN: TABBED CARDS #}
|
||||
<div class="col-lg-4 ">
|
||||
|
||||
{# New Card for Candidate Category Chart #}
|
||||
<div class="card shadow-sm no-hover mb-4">
|
||||
<div class="card-header">
|
||||
<h6 class="mb-0">
|
||||
<i class="fas fa-chart-pie me-2 text-primary"></i>
|
||||
{% trans "Candidate Categories & Scores" %}
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
<div style="height: 300px;">
|
||||
<canvas id="jobCategoryMatchChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm no-hover mb-4">
|
||||
<div class="card-body p-4">
|
||||
<h6 class="text-muted mb-4">{% trans "Applicant Tracking" %}</h6>
|
||||
@ -612,9 +623,15 @@
|
||||
|
||||
|
||||
{% block customJS%}
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script>
|
||||
// Pass data from Django to JavaScript safely
|
||||
window.jobChartData = {
|
||||
categories: {{ categories|safe|default:"[]" }},
|
||||
candidate_counts: {{ candidate_counts|safe|default:"[]" }},
|
||||
avg_scores: {{ avg_scores|safe|default:"[]" }}
|
||||
};
|
||||
|
||||
document.getElementById('copyJobLinkButton').addEventListener('click', function() {
|
||||
// 1. Get the URL from the data attribute
|
||||
const urlToCopy = this.getAttribute('data-url');
|
||||
@ -637,5 +654,85 @@
|
||||
alert("Copy failed. Please copy the URL manually: " + urlToCopy);
|
||||
});
|
||||
});
|
||||
|
||||
// Chart for Candidate Categories and Match Scores
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const ctx = document.getElementById('jobCategoryMatchChart');
|
||||
if (!ctx) {
|
||||
console.warn('Job category chart canvas not found.');
|
||||
return;
|
||||
}
|
||||
const chartCtx = ctx.getContext('2d');
|
||||
|
||||
// Safely get job_category_data from Django context
|
||||
// Using window.jobChartData to avoid template parsing issues
|
||||
const jobChartData = window.jobChartData || { categories: [], candidate_counts: [], avg_scores: []};
|
||||
|
||||
const categories = jobChartData.categories || [];
|
||||
const candidateCounts = jobChartData.candidate_counts || [];
|
||||
const avgScores = jobChartData.avg_scores || [];
|
||||
|
||||
if (categories.length > 0) { // Only render if there's data
|
||||
const chart = new Chart(chartCtx, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
labels: categories,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Number of Candidates',
|
||||
data: candidateCounts,
|
||||
backgroundColor: [
|
||||
'rgba(0, 99, 110, 0.7)', // --kaauh-teal
|
||||
'rgba(23, 162, 184, 0.7)', // Teal shade
|
||||
'rgba(0, 150, 136, 0.7)', // Teal green
|
||||
'rgba(0, 188, 212, 0.7)', // Cyan
|
||||
'rgba(38, 166, 154, 0.7)', // Turquoise
|
||||
'rgba(77, 182, 172, 0.7)', // Medium teal
|
||||
// Add more colors if you expect more categories
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(0, 99, 110, 1)',
|
||||
'rgba(23, 162, 184, 1)',
|
||||
'rgba(0, 150, 136, 1)',
|
||||
'rgba(0, 188, 212, 1)',
|
||||
'rgba(38, 166, 154, 1)',
|
||||
'rgba(77, 182, 172, 1)',
|
||||
// Add more colors if you expect more categories
|
||||
],
|
||||
borderWidth: 1,
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false, // Important for fixed height container
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'right', // Position legend for doughnut chart
|
||||
},
|
||||
title: {
|
||||
display: false, // Chart title is handled by the card header
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function(context) {
|
||||
let label = context.label || '';
|
||||
if (label) {
|
||||
label += ': ';
|
||||
}
|
||||
label += context.parsed + ' candidate(s)';
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Display a message if no data is available
|
||||
chartCtx.canvas.parentNode.innerHTML = '<p class="text-center text-muted mt-4">No candidate category data available for this job.</p>';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -225,10 +225,9 @@
|
||||
<option value="ARCHIVED" {% if status_filter == 'ARCHIVED' %}selected{% endif %}>{% trans "Archived" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
<div class="filter-buttons">
|
||||
|
||||
<button type="submit" class="btn btn-main-action btn-lg">
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-filter me-1"></i> {% trans "Apply Filters" %}
|
||||
</button>
|
||||
{% if job_filter or search_query %}
|
||||
@ -267,7 +266,7 @@
|
||||
<th scope="col" rowspan="2" style="width: 8%;">{% trans "Actions" %}</th>
|
||||
<th scope="col" rowspan="2" class="text-center" style="width: 8%;">{% trans "Manage Forms" %}</th>
|
||||
|
||||
<th scope="col" colspan="7" class="candidate-management-header-title">
|
||||
<th scope="col" colspan="5" class="candidate-management-header-title">
|
||||
{% trans "Applicants Metrics" %}
|
||||
</th>
|
||||
</tr>
|
||||
@ -275,20 +274,8 @@
|
||||
<tr class="nested-metrics-row">
|
||||
<th style="width: calc(50% / 7);">{% trans "Applied" %}</th>
|
||||
<th style="width: calc(50% / 7);">{% trans "Screened" %}</th>
|
||||
|
||||
<th colspan="2" style="width: calc(50% / 7 * 2);">{% trans "Exam" %}
|
||||
<div class="nested-stage-metrics">
|
||||
<span>P</span>
|
||||
<span>F</span>
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th colspan="2" style="width: calc(50% / 7 * 2);">{% trans "Interview" %}
|
||||
<div class="nested-stage-metrics">
|
||||
<span>P</span>
|
||||
<span>F</span>
|
||||
</div>
|
||||
</th>
|
||||
<th style="width: calc(50% / 7 * 2);">{% trans "Exam" %}</th>
|
||||
<th style="width: calc(50% / 7 * 2);">{% trans "Interview" %}</th>
|
||||
<th style="width: calc(50% / 7);">{% trans "Offer" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -332,13 +319,11 @@
|
||||
</td>
|
||||
|
||||
{# CANDIDATE MANAGEMENT DATA - URLS NEUTRALIZED #}
|
||||
<td class="candidate-data-cell text-primary-theme"><a href="#" class="text-primary-theme">{% if job.metrics.applied %}{{ job.metrics.applied }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-info"><a href="#" class="text-info">{% if job.metrics.screening %}{{ job.metrics.screening }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.exam_p %}{{ job.metrics.exam_p }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-danger"><a href="#" class="text-danger">{% if job.metrics.exam_f %}{{ job.metrics.exam_f }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.interview_p %}{{ job.metrics.interview_p }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-danger"><a href="#" class="text-danger">{% if job.metrics.interview_f %}{{ job.metrics.interview_f }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="#" class="text-success">{% if job.metrics.offer %}{{ job.metrics.offer }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-primary-theme"><a href="#" class="text-primary-theme">{% if job.applying_count %}{{ job.applying_count }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-info"><a href="{% url 'candidate_screening_view' job.slug %}" class="text-info">{% if job.screening_count %}{{ job.screening_count }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="{% url 'candidate_screening_view' job.slug %}" class="text-success">{% if job.exam_count %}{{ job.exam_count }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="{% url 'candidate_exam_view' job.slug %}" class="text-success">{% if job.interview_count %}{{ job.interview_count }}{% else %}-{% endif %}</a></td>
|
||||
<td class="candidate-data-cell text-success"><a href="{% url 'candidate_interview_view' job.slug %}" class="text-success">{% if job.offer_count %}{{ job.offer_count }}{% else %}-{% endif %}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@ -43,39 +43,14 @@
|
||||
|
||||
/* ---------------- STAGE SPECIFIC COLORS ---------------- */
|
||||
|
||||
/* APPLIED STAGE (Teal) */
|
||||
.stage-item[data-stage="Applied"].completed .stage-icon,
|
||||
.stage-item[data-stage="Applied"].active .stage-icon {
|
||||
background-color: var(--stage-applied);
|
||||
color: white;
|
||||
}
|
||||
.stage-item[data-stage="Applied"].active { color: var(--stage-applied); }
|
||||
|
||||
/* EXAM STAGE (Cyan/Info) */
|
||||
.stage-item[data-stage="Exam"].completed .stage-icon,
|
||||
.stage-item[data-stage="Exam"].active .stage-icon {
|
||||
background-color: var(--stage-exam);
|
||||
color: white;
|
||||
}
|
||||
.stage-item[data-stage="Exam"].active { color: var(--stage-exam); }
|
||||
|
||||
/* INTERVIEW STAGE (Yellow/Warning) */
|
||||
.stage-item[data-stage="Interview"].completed .stage-icon,
|
||||
.stage-item[data-stage="Interview"].active .stage-icon {
|
||||
.stage-item.completed .stage-icon,
|
||||
.stage-item.active .stage-icon {
|
||||
background-color: var(--stage-interview);
|
||||
color: var(--kaauh-primary-text); /* Dark text for light background */
|
||||
}
|
||||
.stage-item[data-stage="Interview"].active { color: var(--stage-interview); }
|
||||
|
||||
/* OFFER STAGE (Green/Success) */
|
||||
.stage-item[data-stage="Offer"].completed .stage-icon,
|
||||
.stage-item[data-stage="Offer"].active .stage-icon {
|
||||
background-color: var(--stage-offer);
|
||||
color: white;
|
||||
}
|
||||
.stage-item[data-stage="Offer"].active { color: var(--stage-offer); }
|
||||
|
||||
/* ---------------- GENERIC ACTIVE/COMPLETED STYLING ---------------- */
|
||||
.stage-item.active { color: var(--stage-interview); }
|
||||
|
||||
/* Active State (Applies glow/scale to current stage) */
|
||||
.stage-item.active .stage-icon {
|
||||
@ -134,11 +109,11 @@
|
||||
<i class="fas fa-file-signature cd_screening"></i>
|
||||
</div>
|
||||
<div class="stage-label cd_screening">{% trans "Screened" %}</div>
|
||||
<div class="stage-count">{{ applied_count|default:"0" }}</div>
|
||||
<div class="stage-count">{{ job.screening_candidates.count|default:"0" }}</div>
|
||||
</a>
|
||||
|
||||
{% comment %} CONNECTOR 1 -> 2 {% endcomment %}
|
||||
<div class="stage-connector {% if current_stage != 'Applied' and candidate.stage_history_has.Exam %}completed{% endif %}"></div>
|
||||
<div class="stage-connector {% if current_stage == 'Exam' or current_stage == 'Interview' or current_stage == 'Offer' %}completed{% endif %}"></div>
|
||||
|
||||
{% comment %} STAGE 2: Exam {% endcomment %}
|
||||
<a href="{% url 'candidate_exam_view' job.slug %}"
|
||||
@ -148,11 +123,11 @@
|
||||
<i class="fas fa-clipboard-check cd_exam"></i>
|
||||
</div>
|
||||
<div class="stage-label cd_exam">{% trans "Exam" %}</div>
|
||||
<div class="stage-count ">{{ exam_count|default:"0" }}</div>
|
||||
<div class="stage-count ">{{ job.exam_candidates.count|default:"0" }}</div>
|
||||
</a>
|
||||
|
||||
{% comment %} CONNECTOR 2 -> 3 {% endcomment %}
|
||||
<div class="stage-connector {% if current_stage != 'Exam' and candidate.stage_history_has.Interview %}completed{% endif %}"></div>
|
||||
<div class="stage-connector {% if current_stage == 'Interview' or current_stage == 'Offer' %}completed{% endif %}"></div>
|
||||
|
||||
{% comment %} STAGE 3: Interview {% endcomment %}
|
||||
<a href="{% url 'candidate_interview_view' job.slug %}"
|
||||
@ -162,21 +137,21 @@
|
||||
<i class="fas fa-comments cd_interview"></i>
|
||||
</div>
|
||||
<div class="stage-label cd_interview">{% trans "Interview" %}</div>
|
||||
<div class="stage-count">{{ interview_count|default:"0" }}</div>
|
||||
<div class="stage-count">{{ job.interview_candidates.count|default:"0" }}</div>
|
||||
</a>
|
||||
|
||||
{% comment %} CONNECTOR 3 -> 4 {% endcomment %}
|
||||
<div class="stage-connector {% if current_stage != 'Interview' and candidate.stage_history_has.Offer %}completed{% endif %}"></div>
|
||||
<div class="stage-connector {% if current_stage == 'Offer' %}completed{% endif %}"></div>
|
||||
|
||||
{% comment %} STAGE 4: Offer {% endcomment %}
|
||||
<a href="{% url 'job_candidates_list' job.slug %}?stage=Offer"
|
||||
class="stage-item {% if current_stage == 'Offer' %}active{% endif %} {% if current_stage != 'Offer' and candidate.stage_history_has.Offer %}completed{% endif %}"
|
||||
<a href="{% url 'candidate_offer_view' job.slug %}"
|
||||
class="stage-item {% if current_stage == 'Offer' %}active{% endif %} {% if current_stage == 'Interview' %}completed{% endif %}"
|
||||
data-stage="Offer">
|
||||
<div class="stage-icon">
|
||||
<i class="fas fa-handshake"></i>
|
||||
</div>
|
||||
<div class="stage-label">{% trans "Offer" %}</div>
|
||||
<div class="stage-count">{{ offer_count|default:"0" }}</div>
|
||||
<div class="stage-count">{{ job.offer_candidates.count|default:"0" }}</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
{% load i18n %}
|
||||
<form action="{% url 'delete_meeting_for_candidate' job.slug candidate.pk meeting.pk %}" method="post">
|
||||
<form action="{{ delete_url }}" method="post" class="d-flex flex-column gap-2 py-2 px-4">
|
||||
{% csrf_token %}
|
||||
<p class="text-danger">{% trans "Are you sure you want to delete this meeting? This action is irreversible." %}</p>
|
||||
<button type="submit" class="btn btn-danger">{% trans "Delete Meeting" %}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||
<div class="d-flex gap-2 justify-content-end">
|
||||
|
||||
<button type="submit" class="btn btn-danger">{% trans "Delete Meeting" %}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -92,6 +92,7 @@
|
||||
}
|
||||
/* Status Badge Mapping */
|
||||
.bg-waiting { background-color: #ffc107 !important; color: var(--kaauh-primary-text) !important;}
|
||||
.bg-scheduled { background-color: #ffc107 !important; color: var(--kaauh-primary-text) !important;}
|
||||
.bg-started { background-color: var(--kaauh-teal) !important; color: white !important;}
|
||||
.bg-ended { background-color: #dc3545 !important; color: white !important;}
|
||||
|
||||
@ -186,8 +187,8 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<form method="GET" class="row g-3 align-items-end" >
|
||||
{% if search_query %}<input type="hidden" name="q" value="{{ search_query }}">{% endif %}
|
||||
{% if status_filter %}<input type="hidden" name="status" value="{{ status_filter }}">{% endif %}
|
||||
{% if search_query %}<input class="form-control form-control-sm" type="hidden" name="q" value="{{ search_query }}">{% endif %}
|
||||
{% if status_filter %}<input class="form-control form-control-sm" type="hidden" name="status" value="{{ status_filter }}">{% endif %}
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="status" class="form-label small text-muted">{% trans "Filter by Status" %}</label>
|
||||
@ -204,11 +205,11 @@
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="filter-buttons">
|
||||
<button type="submit" class="btn btn-main-action btn-lg">
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-filter me-1"></i> {% trans "Apply Filters" %}
|
||||
</button>
|
||||
{% if status_filter or search_query or candidate_name_filter %}
|
||||
<a href="{% url 'list_meetings' %}" class="btn btn-outline-secondary btn-lg">
|
||||
<a href="{% url 'list_meetings' %}" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="fas fa-times me-1"></i> {% trans "Clear" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
@ -238,10 +239,24 @@
|
||||
</div>
|
||||
|
||||
<p class="card-text text-muted small mb-3">
|
||||
<i class="fas fa-user"></i> {% trans "Candidate" %}: {% with interview=meeting.interview_details.first %}{% if interview %}{{ interview.candidate.name }}{% else %}{% trans "N/A" %}{% endif %}{% endwith %}<br>
|
||||
<i class="fas fa-briefcase"></i> {% trans "Job" %}: {% with interview=meeting.interview_details.first %}{% if interview %}{{ interview.job.title }}{% else %}{% trans "N/A" %}{% endif %}{% endwith %}<br>
|
||||
<i class="fas fa-user"></i> {% trans "Candidate" %}: {% if meeting.interview %}{{ meeting.interview.candidate.name }}{% else %}
|
||||
<button data-bs-toggle="modal"
|
||||
data-bs-target="#meetingModal"
|
||||
hx-get="{% url 'set_meeting_candidate' meeting.slug %}"
|
||||
hx-target="#meetingModalBody"
|
||||
hx-swap="outerHTML"
|
||||
class="btn text-primary-theme btn-link btn-sm">Set Candidate</button>
|
||||
{% endif %}<br>
|
||||
<i class="fas fa-briefcase"></i> {% trans "Job" %}: {% if meeting.interview %}{{ meeting.interview.job.title }}{% else %}
|
||||
<button data-bs-toggle="modal"
|
||||
data-bs-target="#meetingModal"
|
||||
hx-get="{% url 'set_meeting_candidate' meeting.slug %}"
|
||||
hx-target="#meetingModalBody"
|
||||
hx-swap="outerHTML"
|
||||
class="btn text-primary-theme btn-link btn-sm">Set Job</button>
|
||||
{% endif %}<br>
|
||||
<i class="fas fa-hashtag"></i> {% trans "ID" %}: {{ meeting.meeting_id|default:meeting.id }}<br>
|
||||
<i class="fas fa-clock"></i> {% trans "Start" %}: {{ meeting.start_time|date:"M d, Y H:i" }} ({{ meeting.timezone }})<br>
|
||||
<i class="fas fa-clock"></i> {% trans "Start" %}: {{ meeting.start_time|date:"M d, Y H:i" }}<br>
|
||||
<i class="fas fa-stopwatch"></i> {% trans "Duration" %}: {{ meeting.duration }} minutes{% if meeting.password %}<br><i class="fas fa-lock"></i> {% trans "Password" %}: Yes{% endif %}
|
||||
</p>
|
||||
|
||||
@ -262,7 +277,9 @@
|
||||
</a>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" title="{% trans 'Delete' %}"
|
||||
data-bs-toggle="modal" data-bs-target="#deleteModal"
|
||||
data-delete-url="{% url 'delete_meeting' meeting.slug %}"
|
||||
hx-post="{% url 'delete_meeting' meeting.slug %}"
|
||||
hx-target="#deleteModalBody"
|
||||
hx-swap="outerHTML"
|
||||
data-item-name="{{ meeting.topic }}">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
@ -295,25 +312,43 @@
|
||||
<tr>
|
||||
<td><strong class="text-primary">{{ meeting.topic }}</strong></td>
|
||||
<td>
|
||||
{% with interview=meeting.interview_details.first %}
|
||||
{% if interview %}{{ interview.candidate.name }}{% else %}{% trans "N/A" %}{% endif %}
|
||||
{% endwith %}
|
||||
{% if meeting.interview %}
|
||||
<a class="text-primary text-decoration-none" href="{% url 'candidate_detail' meeting.interview.candidate.slug %}">{{ meeting.interview.candidate.name }} <i class="fas fa-link"></i></a>
|
||||
{% else %}
|
||||
<button data-bs-toggle="modal"
|
||||
data-bs-target="#meetingModal"
|
||||
hx-get="{% url 'set_meeting_candidate' meeting.slug %}"
|
||||
hx-target="#meetingModalBody"
|
||||
hx-swap="outerHTML"
|
||||
class="btn btn-outline-primary btn-sm">Set Candidate</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% with interview=meeting.interview_details.first %}
|
||||
{% if interview %}{{ interview.job.title }}{% else %}{% trans "N/A" %}{% endif %}
|
||||
{% endwith %}
|
||||
{% if meeting.interview %}
|
||||
<a class="text-primary text-decoration-none" href="{% url 'job_detail' meeting.interview.job.slug %}">{{ meeting.interview.job.title }} <i class="fas fa-link"></i></a>
|
||||
{% else %}
|
||||
<button data-bs-toggle="modal"
|
||||
data-bs-target="#meetingModal"
|
||||
hx-get="{% url 'set_meeting_candidate' meeting.slug %}"
|
||||
hx-target="#meetingModalBody"
|
||||
hx-swap="outerHTML"
|
||||
class="btn btn-outline-primary btn-sm">Set Job</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ meeting.meeting_id|default:meeting.id }}</td>
|
||||
<td>{{ meeting.start_time|date:"M d, Y H:i" }} ({{ meeting.timezone }})</td>
|
||||
<td>{{ meeting.duration }} min{% if meeting.password %} ({% trans "Password" %}){% endif %}</td>
|
||||
<td>{{ meeting.start_time|date:"M d, Y H:i" }}</td>
|
||||
<td>{{ meeting.duration }} min</td>
|
||||
<td>
|
||||
{% if meeting.status == "started" %}
|
||||
<span class="status-badge bg-{{ meeting.status }}">
|
||||
{{ meeting.status|title }}
|
||||
{% include "icons/video.html" %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if meeting %}
|
||||
<span class="badge {% if meeting.status == 'waiting' %}bg-warning{% elif meeting.status == 'started' %}bg-success{% elif meeting.status == 'ended' %}bg-danger{% endif %}">
|
||||
{% if meeting.status == 'started' %}
|
||||
<i class="fas fa-circle me-1 text-success"></i>
|
||||
{% endif %}
|
||||
{{ meeting.status|title }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
@ -329,8 +364,11 @@
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-outline-danger" title="{% trans 'Delete' %}"
|
||||
data-bs-toggle="modal" data-bs-target="#deleteModal"
|
||||
data-delete-url="{% url 'delete_meeting' meeting.slug %}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#meetingModal"
|
||||
hx-post="{% url 'delete_meeting' meeting.slug %}"
|
||||
hx-target="#meetingModalBody"
|
||||
hx-swap="outerHTML"
|
||||
data-item-name="{{ meeting.topic }}">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
|
||||
@ -83,7 +83,7 @@ body {
|
||||
}
|
||||
.card-header .btn-secondary-back {
|
||||
/* Subtle Back Button */
|
||||
align-self: flex-start;
|
||||
align-self: flex-start;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: var(--kaauh-secondary-text);
|
||||
@ -215,7 +215,7 @@ body {
|
||||
/* 🎯 Copy Message Pill Style */
|
||||
#copy-message {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
top: -5px;
|
||||
right: 0;
|
||||
background-color: var(--kaauh-success);
|
||||
color: white;
|
||||
@ -300,7 +300,7 @@ body {
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
|
||||
|
||||
<div class="card no-hover">
|
||||
<div class="card-header">
|
||||
<div class="card-header-title-group">
|
||||
@ -311,16 +311,25 @@ body {
|
||||
</svg>
|
||||
{{ meeting.topic }}
|
||||
</h1>
|
||||
<span class="status-badge bg-{{ meeting.status }}">
|
||||
{{ meeting.status|title }}
|
||||
</span>
|
||||
<div class="col-auto">
|
||||
<span class="status-badge bg-{{ meeting.status }}">
|
||||
{{ meeting.status|title }}
|
||||
</span>
|
||||
</div>
|
||||
{% if meeting.interview %}
|
||||
<div class="col-auto">
|
||||
<span class="status-badge">
|
||||
Candidate Name : <a class="text-primary-theme" href="{% url 'candidate_detail' meeting.interview.candidate.slug %}">{{ meeting.interview.candidate.name }} </a>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a href="{% url 'list_meetings' %}" class="btn btn-secondary-back">
|
||||
<i class="fas fa-arrow-left"></i> {% trans "Back to Meetings" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card no-hover">
|
||||
<h2>{% trans "Meeting Information" %}</h2>
|
||||
<div class="card-body detail-row-group">
|
||||
@ -332,7 +341,6 @@ body {
|
||||
<div class="detail-row"><div class="detail-label">{% trans "Host Email" %}:</div><div class="detail-value">{{ meeting.host_email|default:"N/A" }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if meeting.join_url %}
|
||||
<div class="card no-hover join-info-card">
|
||||
<h2>{% trans "Join Information" %}</h2>
|
||||
@ -340,14 +348,14 @@ body {
|
||||
<a href="{{ meeting.join_url }}" class="btn btn-primary" target="_blank">
|
||||
<i class="fas fa-video"></i> {% trans "Join Meeting Now" %}
|
||||
</a>
|
||||
|
||||
|
||||
<div class="join-url-container">
|
||||
<div id="copy-message" style="opacity: 0;">{% trans "Copied!" %}</div>
|
||||
|
||||
|
||||
<div class="join-url-display" id="join-url-display">
|
||||
<strong>{% trans "Join URL" %}:</strong> <span id="meeting-join-url">{{ meeting.join_url }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="btn-copy" onclick="copyLink()">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
@ -378,19 +386,21 @@ body {
|
||||
<a href="{% url 'update_meeting' meeting.slug %}" class="btn btn-primary">
|
||||
<i class="fas fa-edit"></i> {% trans "Update Meeting" %}
|
||||
</a>
|
||||
|
||||
|
||||
{% if meeting.zoom_gateway_response %}
|
||||
<button type="button" class="btn btn-secondary" onclick="toggleGateway()">
|
||||
<i class="fas fa-code"></i> {% trans "View API Response" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url 'delete_meeting' meeting.pk %}" style="display: inline;">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-danger" onclick="return confirm('{% trans "Are you sure you want to delete this meeting? This action is permanent." %}')">
|
||||
<i class="fas fa-trash-alt"></i> {% trans "Delete Meeting" %}
|
||||
</button>
|
||||
</form>
|
||||
<button type="button" class="btn btn-danger" title="{% trans 'Delete' %}"
|
||||
data-bs-toggle="modal" data-bs-target="#deleteModal"
|
||||
hx-post="{% url 'delete_meeting' meeting.slug %}"
|
||||
hx-target="#deleteModalBody"
|
||||
hx-swap="outerHTML"
|
||||
data-item-name="{{ meeting.topic }}">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
Delete Meeting
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -402,7 +412,87 @@ body {
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Comments Section -->
|
||||
<div class="card no-hover" id="comments-card">
|
||||
<div class="card-header text-primary-theme d-flex justify-content-between align-items-center">
|
||||
<h5 class="card-title mb-0">
|
||||
<i class="fas fa-comments me-2"></i>
|
||||
Comments ({{ meeting.comments.count }})
|
||||
</h5>
|
||||
{% if user.is_authenticated %}
|
||||
<button type="button" class="btn btn-primary btn-sm"
|
||||
hx-get="{% url 'add_meeting_comment' meeting.slug %}"
|
||||
hx-target="#comment-section"
|
||||
>
|
||||
<i class="fas fa-plus"></i> Add Comment
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="comment-section">
|
||||
{% if meeting.comments.all %}
|
||||
<div class="row">
|
||||
{% for comment in meeting.comments.all|dictsortreversed:"created_at" %}
|
||||
<div class="col-12 mb-3">
|
||||
<div class="card ">
|
||||
<div class="card-header d-flex justify-content-between align-items-start">
|
||||
<div>
|
||||
<strong>{{ comment.author.get_full_name|default:comment.author.username }}</strong>
|
||||
{% if comment.author != user %}
|
||||
<span class="badge bg-secondary ms-2">Comment</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<small class="text-muted">{{ comment.created_at|date:"M d, Y P" }}</small>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">{{ comment.content|safe }}</p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
{% if comment.author == user or user.is_staff %}
|
||||
<div class="btn-group btn-group-sm">
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
hx-get="{% url 'edit_meeting_comment' meeting.slug comment.id %}"
|
||||
hx-target="#comment-section"
|
||||
title="Edit Comment">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-danger"
|
||||
hx-get="{% url 'delete_meeting_comment' meeting.slug comment.id %}"
|
||||
hx-target="#comment-section"
|
||||
title="Delete Comment">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-muted">No comments yet. Be the first to comment!</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Comment Modal (for Add/Edit) -->
|
||||
<div class="modal fade" id="commentModal" tabindex="-1" aria-labelledby="commentModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="commentModalLabel">Add Comment</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="commentModalBody">
|
||||
<!-- HTMX will load the form here -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block customJS %}
|
||||
<script>
|
||||
@ -419,7 +509,7 @@ body {
|
||||
const urlElement = document.getElementById('meeting-join-url');
|
||||
const messageElement = document.getElementById('copy-message');
|
||||
const textToCopy = urlElement.textContent || urlElement.innerText;
|
||||
|
||||
|
||||
// Clear any existing message
|
||||
clearTimeout(window.copyMessageTimeout);
|
||||
|
||||
@ -428,7 +518,7 @@ body {
|
||||
messageElement.textContent = success ? '{% trans "Copied!" %}' : '{% trans "Copy Failed." %}';
|
||||
messageElement.style.backgroundColor = success ? 'var(--kaauh-success)' : 'var(--kaauh-danger)';
|
||||
messageElement.style.opacity = '1';
|
||||
|
||||
|
||||
// Hide the message after 2 seconds
|
||||
window.copyMessageTimeout = setTimeout(() => {
|
||||
messageElement.style.opacity = '0';
|
||||
@ -453,7 +543,7 @@ body {
|
||||
function fallbackCopyTextToClipboard(text, callback) {
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
|
||||
|
||||
textArea.style.top = "0";
|
||||
textArea.style.left = "0";
|
||||
textArea.style.position = "fixed";
|
||||
@ -473,4 +563,4 @@ body {
|
||||
callback(success); // Call the message function with the result
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
7
templates/meetings/set_candidate_form.html
Normal file
7
templates/meetings/set_candidate_form.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% load i18n crispy_forms_tags %}
|
||||
<form action="{% url 'set_meeting_candidate' meeting.slug %}" method="post" class="d-flex flex-column gap-2 py-2 px-4">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<button type="submit" class="btn bg-primary-theme text-white">{% trans "Save" %}</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||
</form>
|
||||
@ -200,11 +200,9 @@
|
||||
<h1 class="h3 mb-2">{{ candidate.name }}</h1>
|
||||
<div class="d-flex align-items-center gap-2 mb-2">
|
||||
|
||||
<span id="stageDisplay" class="badge"
|
||||
data-class="{'bg-primary': $stage == 'Applied', 'bg-info': $stage == 'Exam', 'bg-warning': $stage == 'Interview', 'bg-success': $stage == 'Offer'}"
|
||||
data-signals-stage="'{{ candidate.stage }}'">
|
||||
<span id="stageDisplay" class="badge">
|
||||
{% trans "Stage:" %}
|
||||
<span data-text="$stage"></span>
|
||||
<span>{{ candidate.stage }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<small class="text-white opacity-75">
|
||||
@ -240,6 +238,11 @@
|
||||
<i class="fas fa-chart-bar me-1"></i> {% trans "Resume Summary" %}
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="analysis-tab" data-bs-toggle="tab" data-bs-target="#analysis-pane" type="button" role="tab" aria-controls="analysis-pane" aria-selected="false">
|
||||
<i class="fas fa-brain me-1"></i> {% trans "AI Analysis" %}
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
@ -313,6 +316,153 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# TAB 4 CONTENT: AI ANALYSIS #}
|
||||
{% if candidate.is_resume_parsed %}
|
||||
<div class="tab-pane fade" id="analysis-pane" role="tabpanel" aria-labelledby="analysis-tab">
|
||||
<h5 class="text-primary mb-4">{% trans "AI Analysis Report" %}</h5>
|
||||
<div class="border-start border-primary ps-3 pt-1 pb-1">
|
||||
{% with analysis=candidate.ai_analysis_data %}
|
||||
|
||||
{# Match Score Card #}
|
||||
<div class="mb-4 p-3 rounded" style="background-color: {% if analysis.match_score >= 70 %}rgba(40, 167, 69, 0.1){% elif analysis.match_score >= 40 %}rgba(255, 193, 7, 0.1){% else %}rgba(220, 53, 69, 0.1){% endif %}">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="mb-0 fw-bold">{% trans "Match Score" %}</h6>
|
||||
<span class="badge {% if analysis.match_score >= 70 %}bg-success{% elif analysis.match_score >= 40 %}bg-warning{% else %}bg-danger{% endif %}">
|
||||
{{ analysis.match_score }}%
|
||||
</span>
|
||||
</div>
|
||||
<div class="progress" style="height: 10px;">
|
||||
<div class="progress-bar {% if analysis.match_score >= 70 %}bg-success{% elif analysis.match_score >= 40 %}bg-warning{% else %}bg-danger{% endif %}"
|
||||
role="progressbar" style="width: {{ analysis.match_score }}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Category & Job Fit #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Category" %}</h6>
|
||||
<p class="mb-2">{{ analysis.category }}</p>
|
||||
|
||||
<h6 class="text-primary fw-bold mb-2 mt-3">{% trans "Job Fit Narrative" %}</h6>
|
||||
<p class="mb-0">{{ analysis.job_fit_narrative }}</p>
|
||||
</div>
|
||||
|
||||
{# Strengths and Weaknesses #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Strengths" %}</h6>
|
||||
<p class="text-success mb-3">{{ analysis.strengths }}</p>
|
||||
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Weaknesses" %}</h6>
|
||||
<p class="text-danger mb-0">{{ analysis.weaknesses }}</p>
|
||||
</div>
|
||||
|
||||
{# Recommendation #}
|
||||
<div class="mb-4 p-3 rounded bg-light">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Recommendation" %}</h6>
|
||||
<p class="mb-0">{{ analysis.recommendation }}</p>
|
||||
</div>
|
||||
|
||||
{# Top Keywords #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Top Keywords" %}</h6>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
{% for keyword in analysis.top_3_keywords %}
|
||||
<span class="badge bg-info text-dark">{{ keyword }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Professional Details #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Professional Details" %}</h6>
|
||||
<p class="mb-1"><strong>{% trans "Years of Experience:" %}</strong> {{ analysis.years_of_experience }}</p>
|
||||
<p class="mb-1"><strong>{% trans "Most Recent Job Title:" %}</strong> {{ analysis.most_recent_job_title }}</p>
|
||||
<p class="mb-1"><strong>{% trans "Experience Industry Match:" %}</strong>
|
||||
<span class="badge {% if analysis.experience_industry_match >= 70 %}bg-success{% elif analysis.experience_industry_match >= 40 %}bg-warning{% else %}bg-danger{% endif %}">
|
||||
{{ analysis.experience_industry_match }}%
|
||||
</span>
|
||||
</p>
|
||||
<p class="mb-1"><strong>{% trans "Soft Skills Score:" %}</strong> {{ analysis.soft_skills_score }}%</p>
|
||||
</div>
|
||||
|
||||
{# Screening Status #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Screening Status" %}</h6>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<span>{% trans "Minimum Requirements Met:" %}</span>
|
||||
{% if analysis.min_req_met_bool %}
|
||||
<span class="badge bg-success">{% trans "Yes" %}</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">{% trans "No" %}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center mt-2">
|
||||
<span>{% trans "Screening Stage Rating:" %}</span>
|
||||
<span class="badge bg-secondary">{{ analysis.screening_stage_rating }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Criteria Checklist #}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Criteria Assessment" %}</h6>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Criteria" %}</th>
|
||||
<th>{% trans "Status" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for criterion, status in analysis.criteria_checklist.items %}
|
||||
<tr>
|
||||
<td>{{ criterion }}</td>
|
||||
<td>
|
||||
{% if status == "Met" %}
|
||||
<span class="badge bg-success">{% trans "Met" %}</span>
|
||||
{% elif status == "Not Met" %}
|
||||
<span class="badge bg-danger">{% trans "Not Met" %}</span>
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">{{ status }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Language Fluency #}
|
||||
{% if analysis.language_fluency %}
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary fw-bold mb-2">{% trans "Language Fluency" %}</h6>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
{% for language in analysis.language_fluency %}
|
||||
<span class="badge bg-light text-dark">{{ language }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="tab-pane fade" id="analysis-pane" role="tabpanel" aria-labelledby="analysis-tab">
|
||||
<div class="text-center py-5">
|
||||
<div class="spinner-border text-primary mb-3" role="status">
|
||||
<span class="visually-hidden">{% trans "Loading..." %}</span>
|
||||
</div>
|
||||
<h5 class="text-primary">{% trans "Resume is being parsed" %}</h5>
|
||||
<p class="text-muted">{% trans "Our AI is analyzing the candidate's resume to generate insights. This may take a few moments." %}</p>
|
||||
<div class="progress mt-3" style="height: 6px;">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated"
|
||||
role="progressbar" style="width: 75%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -426,4 +576,4 @@
|
||||
{% if user.is_staff %}
|
||||
{% include "recruitment/partials/stage_update_modal.html" with candidate=candidate form=stage_form %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -37,15 +37,18 @@
|
||||
{% csrf_token %}
|
||||
<label for="update_status" class="form-label small mb-0 fw-bold">{% trans "Move Selected To:" %}</label>
|
||||
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: auto;">
|
||||
<option selected>
|
||||
----------
|
||||
</option>
|
||||
<option value="Interview">
|
||||
{% trans "Interview Stage" %}
|
||||
</option>
|
||||
<option value="Applied">
|
||||
{% trans "Screening Stage" %}
|
||||
</option>
|
||||
<option value="Interview">
|
||||
{% trans "Interview Stage" %}
|
||||
</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-arrow-right me-1"></i> {% trans "Update Status" %}
|
||||
<i class="fas fa-arrow-right me-1"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@ -56,7 +59,7 @@
|
||||
<table class="table candidate-table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<th style="width: 2%;">
|
||||
{% if candidates %}
|
||||
<div class="form-check">
|
||||
<input
|
||||
@ -64,12 +67,12 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "Contact" %}</th>
|
||||
<th class="text-center">{% trans "AI Score" %}</th>
|
||||
<th class="text-center">{% trans "Exam Status" %}</th>
|
||||
<th>{% trans "Exam Date" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
<th style="width: 15%;">{% trans "Name" %}</th>
|
||||
<th style="width: 15%;">{% trans "Contact" %}</th>
|
||||
<th style="width: 10%;" class="text-center">{% trans "AI Score" %}</th>
|
||||
<th style="width: 15%;">{% trans "Exam Date" %}</th>
|
||||
<th style="width: 10%;" class="text-center">{% trans "Exam Results" %}</th>
|
||||
<th style="width: 15%;">{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -86,14 +89,6 @@
|
||||
<td>
|
||||
<div class="candidate-name">
|
||||
{{ candidate.name }}
|
||||
{# Tier badges now use defined stage-badge and tier-X-badge classes #}
|
||||
{% if forloop.counter <= tier1_count %}
|
||||
<span class="stage-badge tier-1-badge">Tier 1</span>
|
||||
{% elif forloop.counter <= tier1_count|default:0|add:tier1_count %}
|
||||
<span class="stage-badge tier-2-badge">Tier 2</span>
|
||||
{% else %}
|
||||
<span class="stage-badge tier-3-badge">Tier 3+</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@ -105,34 +100,39 @@
|
||||
<td class="text-center">
|
||||
<span class="badge ai-score-badge">{{ candidate.match_score|default:"0" }}%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if candidate.exam_status == "Passed" %}
|
||||
<span class="status-badge bg-success">{{ candidate.exam_status }}</span>
|
||||
{% elif candidate.exam_status == "Failed" %}
|
||||
<span class="status-badge bg-danger">{{ candidate.exam_status }}</span>
|
||||
{% else %}
|
||||
<span class="status-badge bg-info">Pending</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{candidate.exam_date|date:"M d, Y h:i A"|default:"N/A"}}
|
||||
{{candidate.exam_date|date:"d-m-Y h:i A"|default:"--"}}
|
||||
</td>
|
||||
<td class="d-flex flex-wrap gap-1">
|
||||
|
||||
<td class="text-center">
|
||||
{% if not candidate.exam_status %}
|
||||
<button type="button" class="btn btn-warning btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'update_candidate_status' job.slug candidate.slug 'exam' 'passed' %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="Pass Exam">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
{% if candidate.exam_status == "Passed" %}
|
||||
<span class="status-badge bg-success">{{ candidate.exam_status }}</span>
|
||||
{% elif candidate.exam_status == "Failed" %}
|
||||
<span class="status-badge bg-danger">{{ candidate.exam_status }}</span>
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td >
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'candidate_criteria_view_htmx' candidate.pk %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="View Profile">
|
||||
<i class="fas fa-eye"></i> View
|
||||
</button>
|
||||
<button type="button" class="btn btn-main-action btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'update_candidate_exam_status' candidate.slug %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="Set Exam Status/Date">
|
||||
<i class="fas fa-calendar-alt"></i> Set Exam
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@ -227,4 +227,4 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -30,15 +30,18 @@
|
||||
<form hx-boost="true" hx-include="#candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="post" class="action-group">
|
||||
{% csrf_token %}
|
||||
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: 120px;">
|
||||
<option value="Exam">
|
||||
{% trans "To Exam" %}
|
||||
<option selected>
|
||||
----------
|
||||
</option>
|
||||
<option value="Offer">
|
||||
{% trans "To Offer" %}
|
||||
</option>
|
||||
<option value="Exam">
|
||||
{% trans "To Exam" %}
|
||||
</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-arrow-right me-1"></i> {% trans "Update" %}
|
||||
<i class="fas fa-arrow-right me-1"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@ -50,12 +53,13 @@
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="table-responsive">
|
||||
<form id="candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="get">
|
||||
{% csrf_token %}
|
||||
<table class="table candidate-table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<th style="width: 2%">
|
||||
{% if candidates %}
|
||||
<div class="form-check">
|
||||
<input
|
||||
@ -63,13 +67,15 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "Contact" %}</th>
|
||||
<th>{% trans "Topic" %}</th>
|
||||
<th>{% trans "Duration" %}</th>
|
||||
<th>{% trans "Interview Date" %}</th>
|
||||
<th>{% trans "Interview Link" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
<th style="width: 8%"><i class="fas fa-user me-1"></i> {% trans "Name" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-phone me-1"></i> {% trans "Contact" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-tag me-1"></i> {% trans "Topic" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-clock me-1"></i> {% trans "Duration" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-calendar me-1"></i> {% trans "Meeting Date" %}</th>
|
||||
<th style="width: 5%"><i class="fas fa-video me-1"></i> {% trans "Link" %}</th>
|
||||
<th style="width: 5%"><i class="fas fa-check-circle me-1"></i> {% trans "Meeting Status" %}</th>
|
||||
<th style="width: 5%"><i class="fas fa-check-circle me-1"></i> {% trans "Interview Result" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-cog me-1"></i> {% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -91,28 +97,77 @@
|
||||
<i class="fas fa-phone me-1"></i> {{ candidate.phone }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="candidate-details text-muted">{{ candidate.get_latest_meeting.topic }}</td>
|
||||
<td class="candidate-details text-muted"><div class="d-block"><i class="fas fa-clock me-1"></i> {{ candidate.get_latest_meeting.duration }} min</div></td>
|
||||
<td class="candidate-details text-muted">
|
||||
{% if candidate.get_latest_meeting.topic %}
|
||||
{{ candidate.get_latest_meeting.topic }}
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="candidate-details text-muted"><div class="d-block">
|
||||
{% if candidate.get_latest_meeting.duration %}
|
||||
{{ candidate.get_latest_meeting.duration }} {% trans _("Minutes") %}
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</div></td>
|
||||
<td class="candidate-details text-muted">
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting %}
|
||||
{{ latest_meeting.start_time|date:"M d, Y h:i A" }}
|
||||
{{ latest_meeting.start_time|date:"d-m-Y h:i A" }}
|
||||
{% else %}
|
||||
<span class="text-muted">N/A</span>
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting and latest_meeting.join_url %}
|
||||
<a href="{{ latest_meeting.join_url }}" target="_blank" class="text-primary-theme" title="Join Interview">
|
||||
<i class="fas fa-link"></i>
|
||||
<a href="{{ latest_meeting.join_url }}" target="_blank" class="btn btn-sm bg-primary-theme text-white" title="Join Interview"
|
||||
{% if latest_meeting.status == 'ended' %}disabled{% endif %}>
|
||||
click to join
|
||||
<i class="fas fa-video me-1"></i>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
{{ latest_meeting.status }}
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting %}
|
||||
<span class="badge {% if latest_meeting.status == 'waiting' %}bg-warning{% elif latest_meeting.status == 'started' %}bg-success{% elif latest_meeting.status == 'ended' %}bg-danger{% endif %}">
|
||||
{% if latest_meeting.status == 'started' %}
|
||||
<i class="fas fa-circle me-1 text-success"></i>
|
||||
{% endif %}
|
||||
{{ latest_meeting.status|title }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if not candidate.interview_status %}
|
||||
<button type="button" class="btn btn-warning btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'update_candidate_status' job.slug candidate.slug 'interview' 'passed' %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="Pass Exam">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
{% if candidate.interview_status == "Passed" %}
|
||||
<span class="status-badge bg-success">{{ candidate.interview_status }}</span>
|
||||
{% elif candidate.interview_status == "Failed" %}
|
||||
<span class="status-badge bg-danger">{{ candidate.interview_status }}</span>
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
@ -139,9 +194,8 @@
|
||||
title="Delete Meeting">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-main-action btn-sm"
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-main-action btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'schedule_meeting_for_candidate' job.slug candidate.pk %}"
|
||||
@ -150,7 +204,8 @@
|
||||
title="Schedule Interview">
|
||||
<i class="fas fa-calendar-plus"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@ -163,7 +218,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -182,11 +237,7 @@
|
||||
{% trans "Loading content..." %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer" style="border-top: 1px solid var(--kaauh-border);">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
|
||||
{% trans "Cancel" %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -293,4 +344,4 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@ -186,11 +186,11 @@
|
||||
|
||||
<div class="col-md-5">
|
||||
<div class="filter-buttons">
|
||||
<button type="submit" class="btn btn-main-action btn-lg">
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-filter me-1"></i> {% trans "Apply Filters" %}
|
||||
</button>
|
||||
{% if job_filter or search_query %}
|
||||
<a href="{% url 'candidate_list' %}" class="btn btn-outline-secondary btn-lg">
|
||||
<a href="{% url 'candidate_list' %}" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="fas fa-times me-1"></i> {% trans "Clear" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
@ -212,13 +212,14 @@
|
||||
<table class="table table-hover mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style="width: 20%;">{% trans "Name" %}</th>
|
||||
<th scope="col" style="width: 20%;">{% trans "Email" %}</th>
|
||||
<th scope="col" style="width: 15%;">{% trans "Phone" %}</th>
|
||||
<th scope="col" style="width: 15%;">{% trans "Name" %}</th>
|
||||
<th scope="col" style="width: 15%;">{% trans "Email" %}</th>
|
||||
<th scope="col" style="width: 10%;">{% trans "Phone" %}</th>
|
||||
<th scope="col" style="width: 15%;">{% trans "Job" %}</th>
|
||||
<th scope="col" style="width: 5%;">{% trans "Major" %}</th>
|
||||
<th scope="col" style="width: 10%;">{% trans "Stage" %}</th>
|
||||
<th scope="col" style="width: 10%;">{% trans "Created" %}</th>
|
||||
<th scope="col" style="width: 10%;" class="text-end">{% trans "Actions" %}</th>
|
||||
<th scope="col" style="width: 15%;">{% trans "created At" %}</th>
|
||||
<th scope="col" style="width: 5%;" class="text-end">{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -228,12 +229,19 @@
|
||||
<td>{{ candidate.email }}</td>
|
||||
<td>{{ candidate.phone }}</td>
|
||||
<td> <span class="badge bg-primary"><a href="{% url 'job_detail' candidate.job.slug %}" class="text-decoration-none text-white">{{ candidate.job.title }}</a></span></td>
|
||||
<td>
|
||||
{% if candidate.professional_category != 'Uncategorized' %}
|
||||
<span class="badge bg-primary">
|
||||
{{ candidate.professional_category }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-primary">
|
||||
{{ candidate.stage }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ candidate.created_at|date:"M d, Y" }}</td>
|
||||
<td>{{ candidate.created_at|date:"d-m-Y" }}</td>
|
||||
<td class="text-end">
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<a href="{% url 'candidate_detail' candidate.slug %}" class="btn btn-outline-primary" title="{% trans 'View' %}">
|
||||
|
||||
273
templates/recruitment/candidate_offer_view.html
Normal file
273
templates/recruitment/candidate_offer_view.html
Normal file
@ -0,0 +1,273 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static i18n %}
|
||||
|
||||
{% block title %}- {{ job.title }} - ATS{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h1 class="h3 mb-1" style="color: var(--kaauh-teal-dark); font-weight: 700;">
|
||||
<i class="fas fa-handshake me-2"></i>
|
||||
{% trans "Offer Management" %} - {{ job.title }}
|
||||
</h1>
|
||||
<h2 class="h5 text-muted mb-0">
|
||||
{% trans "Candidates in Offer Stage:" %} <span class="fw-bold">{{ candidates|length }}</span>
|
||||
</h2>
|
||||
</div>
|
||||
<a href="{% url 'job_detail' job.slug %}" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-arrow-left me-1"></i> {% trans "Back to Job" %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="applicant-tracking-timeline">
|
||||
{% include 'jobs/partials/applicant_tracking.html' %}
|
||||
</div>
|
||||
|
||||
<div class="kaauh-card shadow-sm p-3">
|
||||
{% if candidates %}
|
||||
<div class="bulk-action-bar">
|
||||
|
||||
<form hx-boost="true" hx-include="#candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="post" class="action-group">
|
||||
{% csrf_token %}
|
||||
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: 120px;">
|
||||
<option selected>
|
||||
----------
|
||||
</option>
|
||||
<option value="Hired">
|
||||
{% trans "To Hired" %}
|
||||
</option>
|
||||
<option value="Rejected">
|
||||
{% trans "To Rejected" %}
|
||||
</option>
|
||||
</select>
|
||||
<button type="submit" class="btn btn-main-action btn-sm">
|
||||
<i class="fas fa-arrow-right me-1"></i>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="vr" style="height: 28px;"></div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="table-responsive">
|
||||
<form id="candidate-form" action="{% url 'candidate_update_status' job.slug %}" method="get">
|
||||
{% csrf_token %}
|
||||
<table class="table candidate-table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
{% if candidates %}
|
||||
<div class="form-check">
|
||||
<input
|
||||
type="checkbox" class="form-check-input" id="selectAllCheckbox">
|
||||
</div>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th style="width: 15%"><i class="fas fa-user me-1"></i> {% trans "Name" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-phone me-1"></i> {% trans "Contact" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-tag me-1"></i> {% trans "Topic" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-clock me-1"></i> {% trans "Duration" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-calendar me-1"></i> {% trans "Meeting Date" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-video me-1"></i> {% trans "Meeting Link" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-check-circle me-1"></i> {% trans "Meeting Status" %}</th>
|
||||
<th style="width: 10%"><i class="fas fa-check-circle me-1"></i> {% trans "Offer" %}</th>
|
||||
<th style="width: 15%"><i class="fas fa-cog me-1"></i> {% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for candidate in candidates %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check">
|
||||
<input name="candidate_ids" value="{{ candidate.id }}" type="checkbox" class="form-check-input rowCheckbox" id="candidate-{{ candidate.id }}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="candidate-name">
|
||||
{{ candidate.name }}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="candidate-details">
|
||||
<i class="fas fa-envelope me-1"></i> {{ candidate.email }}<br>
|
||||
<i class="fas fa-phone me-1"></i> {{ candidate.phone }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="candidate-details text-muted">
|
||||
{% if candidate.get_latest_meeting.topic %}
|
||||
{{ candidate.get_latest_meeting.topic }}
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="candidate-details text-muted"><div class="d-block">
|
||||
{% if candidate.get_latest_meeting.duration %}
|
||||
{{ candidate.get_latest_meeting.duration }} {% trans _("Minutes") %}
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
</div></td>
|
||||
<td class="candidate-details text-muted">
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting %}
|
||||
{{ latest_meeting.start_time|date:"d-m-Y h:i A" }}
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting and latest_meeting.join_url %}
|
||||
<a href="{{ latest_meeting.join_url }}" target="_blank" class="btn btn-sm bg-primary-theme text-white" title="Join Interview"
|
||||
{% if latest_meeting.status == 'ended' %}disabled{% endif %}>
|
||||
click to join
|
||||
<i class="fas fa-video me-1"></i>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td>
|
||||
{{ latest_meeting.status }}
|
||||
{% with latest_meeting=candidate.get_latest_meeting %}
|
||||
{% if latest_meeting %}
|
||||
<span class="badge {% if latest_meeting.status == 'waiting' %}bg-warning{% elif latest_meeting.status == 'started' %}bg-success{% elif latest_meeting.status == 'ended' %}bg-danger{% endif %}">
|
||||
{% if latest_meeting.status == 'started' %}
|
||||
<i class="fas fa-circle me-1 text-success"></i>
|
||||
{% endif %}
|
||||
{{ latest_meeting.status|title }}
|
||||
</span>
|
||||
{% else %}
|
||||
<span class="text-muted">--</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if not candidate.offer_status %}
|
||||
<button type="button" class="btn btn-warning btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'update_candidate_status' job.slug candidate.slug 'offer' 'passed' %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="Pass Exam">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
{% if candidate.offer_status == "Accepted" %}
|
||||
<span class="status-badge bg-success">{{ candidate.offer_status }}</span>
|
||||
{% elif candidate.offer_status == "Rejected" %}
|
||||
<span class="status-badge bg-danger">{{ candidate.offer_status }}</span>
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#candidateviewModal"
|
||||
hx-get="{% url 'candidate_criteria_view_htmx' candidate.pk %}"
|
||||
hx-target="#candidateviewModalBody"
|
||||
title="View Profile">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if not candidates %}
|
||||
<div class="alert alert-info text-center mt-3 mb-0" role="alert">
|
||||
<i class="fas fa-info-circle me-1"></i>
|
||||
{% trans "No candidates are currently in the Offer stage for this job." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal fade modal-xl" id="candidateviewModal" tabindex="-1" aria-labelledby="candidateviewModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content kaauh-card"> <div class="modal-header" style="border-bottom: 1px solid var(--kaauh-border);">
|
||||
<h5 class="modal-title" id="candidateviewModalLabel" style="color: var(--kaauh-teal-dark);">
|
||||
{% trans "Candidate Details / Bulk Action Form" %}
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div id="candidateviewModalBody" class="modal-body">
|
||||
<div class="text-center py-5 text-muted">
|
||||
<i class="fas fa-spinner fa-spin fa-2x"></i><br>
|
||||
{% trans "Loading content..." %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block customJS %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const selectAllCheckbox = document.getElementById('selectAllCheckbox');
|
||||
const rowCheckboxes = document.querySelectorAll('.rowCheckbox');
|
||||
|
||||
if (selectAllCheckbox) {
|
||||
|
||||
// Function to safely update the header checkbox state
|
||||
function updateSelectAllState() {
|
||||
const checkedCount = Array.from(rowCheckboxes).filter(cb => cb.checked).length;
|
||||
const totalCount = rowCheckboxes.length;
|
||||
|
||||
if (checkedCount === 0) {
|
||||
selectAllCheckbox.checked = false;
|
||||
selectAllCheckbox.indeterminate = false;
|
||||
} else if (checkedCount === totalCount) {
|
||||
selectAllCheckbox.checked = true;
|
||||
selectAllCheckbox.indeterminate = false;
|
||||
} else {
|
||||
// Set to indeterminate state (partially checked)
|
||||
selectAllCheckbox.checked = false;
|
||||
selectAllCheckbox.indeterminate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Logic for the 'Select All' checkbox (Clicking it updates all rows)
|
||||
selectAllCheckbox.addEventListener('change', function () {
|
||||
const isChecked = selectAllCheckbox.checked;
|
||||
|
||||
// Temporarily disable the change listener on rows to prevent cascading events
|
||||
rowCheckboxes.forEach(checkbox => checkbox.removeEventListener('change', updateSelectAllState));
|
||||
|
||||
// Update all row checkboxes
|
||||
rowCheckboxes.forEach(function (checkbox) {
|
||||
checkbox.checked = isChecked;
|
||||
|
||||
// Dispatch event for the framework (data-bind-selections)
|
||||
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
});
|
||||
|
||||
// Re-attach the change listeners to the rows
|
||||
rowCheckboxes.forEach(checkbox => checkbox.addEventListener('change', updateSelectAllState));
|
||||
|
||||
// Ensure the header state is correct after forcing all changes
|
||||
updateSelectAllState();
|
||||
});
|
||||
|
||||
// 2. Logic to update 'Select All' state based on row checkboxes
|
||||
// Attach the function to be called whenever a row checkbox changes
|
||||
rowCheckboxes.forEach(function (checkbox) {
|
||||
checkbox.addEventListener('change', updateSelectAllState);
|
||||
});
|
||||
|
||||
// Initial check to set the correct state on load (in case items are pre-checked)
|
||||
updateSelectAllState();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@ -72,6 +72,9 @@
|
||||
{% csrf_token %}
|
||||
<label for="update_status" class="form-label small mb-0 fw-bold">{% trans "Move Selected To:" %}</label>
|
||||
<select name="mark_as" id="update_status" class="form-select form-select-sm" style="width: auto;">
|
||||
<option selected>
|
||||
----------
|
||||
</option>
|
||||
<option value="Exam">
|
||||
{% trans "Exam Stage" %}
|
||||
</option>
|
||||
@ -89,7 +92,7 @@
|
||||
<table class="table candidate-table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<th scope="col" style="width: 2%;">
|
||||
{% if candidates %}
|
||||
<div class="form-check">
|
||||
<input
|
||||
@ -97,12 +100,27 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</th>
|
||||
<th>{% trans "Candidate Name" %}</th>
|
||||
<th>{% trans "Contact Info" %}</th>
|
||||
<th class="text-center">{% trans "AI Score" %}</th>
|
||||
<th>{% trans "Application Status" %}</th>
|
||||
<th>{% trans "Current Stage" %}</th>
|
||||
<th class="text-center">{% trans "Actions" %}</th>
|
||||
<th scope="col" style="width: 8%;">
|
||||
<i class="fas fa-user me-1"></i> {% trans "Candidate Name" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 10%;">
|
||||
<i class="fas fa-phone me-1"></i> {% trans "Contact Info" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 6%;" class="text-center">
|
||||
<i class="fas fa-robot me-1"></i> {% trans "AI Score" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 15%;" class="text-center">
|
||||
<i class="fas fa-robot me-1"></i> {% trans "Is Qualified?" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 10%;">
|
||||
<i class="fas fa-graduation-cap me-1"></i> {% trans "Professional Category" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 15%;">
|
||||
<i class="fas fa-graduation-cap me-1"></i> {% trans "Top 3 Skills" %}
|
||||
</th>
|
||||
<th scope="col" style="width: 10%;" class="text-center">
|
||||
<i class="fas fa-cog me-1"></i> {% trans "Actions" %}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -128,26 +146,38 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge ai-score-badge">
|
||||
{{ candidate.match_score|default:"0" }}%
|
||||
</span>
|
||||
{% if candidate.match_score %}
|
||||
<span class="badge ai-score-badge">
|
||||
{{ candidate.match_score|default:"0" }}%
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge status-badge {% if candidate.applicant_status == 'Candidate' %}bg-candidate{% else %}bg-applicant{% endif %}">
|
||||
{{ candidate.get_applicant_status_display }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="stage-badge stage-{{ candidate.stage }}">
|
||||
{{ candidate.get_stage_display }}
|
||||
</span>
|
||||
{% if candidate.stage == "Exam" and candidate.exam_status %}
|
||||
<br>
|
||||
<span class="stage-badge bg-info text-white">
|
||||
{{ candidate.get_exam_status_display }}
|
||||
<td class="text-center">
|
||||
{% if candidate.screening_stage_rating %}
|
||||
<span class="badge ai-score-badge d-inline-block text-wrap">
|
||||
{{ candidate.screening_stage_rating|default:"--" }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% if candidate.professional_category %}
|
||||
<span class="badge ai-score-badge">
|
||||
{{ candidate.professional_category }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if candidate.top_3_keywords %}
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
{% for skill in candidate.top_3_keywords %}
|
||||
<span class="badge ai-score-badge" style="font-size: smaller;">
|
||||
{{ skill }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm"
|
||||
data-bs-toggle="modal"
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
{% load partials %}
|
||||
<!-- Stage Update Modal -->
|
||||
<div class="modal fade" id="stageUpdateModal" tabindex="-1" aria-labelledby="stageUpdateModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-top">
|
||||
@ -9,7 +8,6 @@
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
{% partialdef stage-modal %}
|
||||
<div class="modal-body">
|
||||
<!-- Success/Error Messages Container -->
|
||||
<div id="stageUpdateMessages"></div>
|
||||
@ -32,14 +30,12 @@
|
||||
<label for="id_stage" class="form-label">
|
||||
<i class="fas fa-arrow-right me-1"></i>Move to Stage
|
||||
</label>
|
||||
{% partialdef id-stage %}
|
||||
|
||||
<select id="id_stage" name="stage" class="form-select">
|
||||
{% for value, label in stage_form.stage.field.choices %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% endpartialdef %}
|
||||
{% partial id-stage %}
|
||||
</div>
|
||||
|
||||
<!-- Available Stages Info -->
|
||||
@ -64,8 +60,7 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endpartialdef %}
|
||||
{% partial stage-modal %}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user