File size: 16,029 Bytes
56c7b6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html>
<head>
    <title>Job Application AI Agent</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8f9fa;
            padding-top: 30px;
            padding-bottom: 50px;
            color: #343a40;
        }
        .hero-section {
            background: linear-gradient(135deg, #0d6efd 0%, #0099ff 100%);
            padding: 3rem;
            border-radius: 1rem;
            margin-bottom: 2.5rem;
            color: white;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }
        .card {
            border: none;
            border-radius: 1rem;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            margin-bottom: 2rem;
            overflow: hidden;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .card-header {
            background: linear-gradient(135deg, #0d6efd 0%, #0099ff 100%);
            color: white;
            font-weight: 600;
            padding: 1.25rem;
            border-bottom: none;
        }
        .card-body {
            padding: 1.5rem;
        }
        .btn-primary {
            background: linear-gradient(135deg, #0d6efd 0%, #0099ff 100%);
            border: none;
            padding: 0.6rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 500;
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            background: linear-gradient(135deg, #0957cc 0%, #0080d6 100%);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
        }
        .btn-success {
            background: linear-gradient(135deg, #198754 0%, #20c997 100%);
            border: none;
            padding: 0.6rem 1.5rem;
            border-radius: 0.5rem;
            font-weight: 500;
            transition: all 0.3s ease;
        }
        .btn-success:hover {
            background: linear-gradient(135deg, #146c43 0%, #1aa179 100%);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(25, 135, 84, 0.3);
        }
        .alert {
            border-radius: 0.5rem;
            border: none;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
        }
        .form-control {
            border-radius: 0.5rem;
            padding: 0.75rem 1rem;
            border: 1px solid #dee2e6;
            background-color: #f8f9fa;
        }
        .form-control:focus {
            box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
            border-color: #86b7fe;
            background-color: #fff;
        }
        .form-label {
            font-weight: 500;
            margin-bottom: 0.5rem;
        }
        .feature-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #0d6efd;
        }
        .upload-area {
            border: 2px dashed #dee2e6;
            border-radius: 1rem;
            padding: 2rem;
            text-align: center;
            transition: all 0.3s ease;
            background-color: #f8f9fa;
            margin-bottom: 1.5rem;
            cursor: pointer;
        }
        .upload-area:hover {
            border-color: #0d6efd;
            background-color: #f1f8ff;
        }
        .upload-icon {
            font-size: 2.5rem;
            color: #0d6efd;
            margin-bottom: 1rem;
        }
        .upload-text {
            font-size: 1.1rem;
            color: #495057;
            margin-bottom: 0.5rem;
        }
        .upload-hint {
            font-size: 0.9rem;
            color: #6c757d;
        }
        .file-input {
            display: none;
        }
        .workflow-step {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
        }
        .step-number {
            width: 30px;
            height: 30px;
            background-color: #0d6efd;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-right: 1rem;
        }
        .step-text {
            flex: 1;
        }
        .info-card {
            background-color: #e9f7fe;
            border-left: 4px solid #0d6efd;
            padding: 1rem;
            border-radius: 0.5rem;
            margin-bottom: 1.5rem;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="hero-section text-center">
            <h1 class="display-4 fw-bold mb-3">Job Application AI Agent</h1>
            <p class="lead fs-4 mb-4">Automate your job search and generate tailored CVs with AI</p>
            <div class="row justify-content-center mt-4">
                <div class="col-md-8">
                    <div class="row text-center">
                        <div class="col-md-4">
                            <div class="feature-icon">
                                <i class="fas fa-search"></i>
                            </div>
                            <h5>Find Jobs</h5>
                        </div>
                        <div class="col-md-4">
                            <div class="feature-icon">
                                <i class="fas fa-file-alt"></i>
                            </div>
                            <h5>Tailor CVs</h5>
                        </div>
                        <div class="col-md-4">
                            <div class="feature-icon">
                                <i class="fas fa-check-circle"></i>
                            </div>
                            <h5>Apply Faster</h5>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }} alert-dismissible fade show mb-4" role="alert">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                {% endfor %}
            {% endif %}
        {% endwith %}

        <div class="alert alert-secondary mb-4" role="alert">
            <div class="d-flex justify-content-between align-items-center flex-wrap gap-2">
                <div>
                    <strong>Active Tailoring Mode:</strong>
                    <span class="badge bg-primary text-uppercase ms-1">{{ tailoring_mode or 'local' }}</span>
                    {% if (tailoring_mode or 'local') == 'api' %}
                        <span class="ms-2">Provider: <strong>{{ llm_provider or 'ollama' }}</strong></span>
                    {% endif %}
                </div>
                <form method="POST" action="{{ url_for('set_tailoring_mode') }}" class="d-flex align-items-center gap-2">
                    <label for="tailoring_mode" class="mb-0">Mode</label>
                    <select name="tailoring_mode" id="tailoring_mode" class="form-select form-select-sm" style="width: 170px;">
                        <option value="local" {% if (tailoring_mode or 'local') == 'local' %}selected{% endif %}>Local (Built-in)</option>
                        <option value="api" {% if (tailoring_mode or 'local') == 'api' %}selected{% endif %}>API (Groq/Grok/OpenAI)</option>
                    </select>
                    <button type="submit" class="btn btn-sm btn-primary">Apply</button>
                </form>
            </div>
        </div>
        
        <div class="info-card mb-4">
            <h5><i class="fas fa-info-circle me-2"></i>How It Works</h5>
            <div class="workflow-step">
                <div class="step-number">1</div>
                <div class="step-text">Upload your CV template (.docx format)</div>
            </div>
            <div class="workflow-step">
                <div class="step-number">2</div>
                <div class="step-text">Search for jobs by title and location</div>
            </div>
            <div class="workflow-step">
                <div class="step-number">3</div>
                <div class="step-text">The system tailors your CV for each job by highlighting relevant skills</div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-upload me-2"></i> Step 1: Upload CV Template</h5>
                    </div>
                    <div class="card-body d-flex flex-column">
                        <p>Upload your CV template that will be tailored for each job</p>
                        
                        <form method="POST" enctype="multipart/form-data" action="{{ url_for('upload_cv') }}" id="cv-upload-form">
                            <input type="hidden" name="tailoring_mode" value="{{ tailoring_mode or 'local' }}">
                            <label for="cv_file" class="upload-area" id="upload-label">
                                <div class="upload-icon">
                                    <i class="fas fa-cloud-upload-alt"></i>
                                </div>
                                <h3 class="upload-text">Drag & Drop your CV here</h3>
                                <p class="upload-hint">or click to browse files</p>
                                <p class="upload-hint text-muted">(Only .docx files are supported)</p>
                            </label>
                            <input type="file" name="cv_file" id="cv_file" class="file-input" accept=".docx" required>
                            
                            <div id="file-selected" class="alert alert-info d-none mb-3">
                                <i class="fas fa-file-word me-2"></i>
                                <span id="file-name">No file selected</span>
                            </div>
                            
                            <button type="submit" class="btn btn-primary w-100" id="upload-button">
                                <i class="fas fa-upload me-2"></i>Upload CV Template
                            </button>
                        </form>
                    </div>
                </div>
            </div>
            
            <div class="col-md-6">
                <div class="card h-100">
                    <div class="card-header">
                        <h5 class="mb-0"><i class="fas fa-search me-2"></i> Step 2: Search for Jobs</h5>
                    </div>
                    <div class="card-body">
                        <form action="{{ url_for('search_jobs') }}" method="post">
                            <input type="hidden" name="tailoring_mode" value="{{ tailoring_mode or 'local' }}">
                            <div class="mb-3">
                                <label for="keyword" class="form-label">Job Title</label>
                                <input type="text" class="form-control" id="keyword" name="keyword" placeholder="e.g., Software Engineer" required>
                            </div>
                            <div class="mb-3">
                                <label for="location" class="form-label">Location</label>
                                <input type="text" class="form-control" id="location" name="location" placeholder="e.g., Remote, Berlin" required>
                            </div>
                            <div class="mb-3">
                                <label for="max_jobs" class="form-label">Number of Jobs</label>
                                <input type="number" class="form-control" id="max_jobs" name="max_jobs" value="5" min="1" max="20">
                            </div>
                            <button type="submit" class="btn btn-primary w-100" id="search-button">
                                <i class="fas fa-search me-2"></i>Search Jobs
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="text-center mt-5 text-muted">
            <p>Job Application AI Agent helps you find relevant jobs and tailor your CV to match job requirements</p>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const fileInput = document.getElementById('cv_file');
            const uploadLabel = document.getElementById('upload-label');
            const fileSelected = document.getElementById('file-selected');
            const fileName = document.getElementById('file-name');
            const uploadButton = document.getElementById('upload-button');
            const searchButton = document.getElementById('search-button');
            
            // Check if CV is already uploaded
            {% if session.get('cv_template') %}
                fileSelected.classList.remove('d-none');
                fileName.textContent = "CV template uploaded successfully";
                uploadButton.innerHTML = '<i class="fas fa-check-circle me-2"></i>CV Template Uploaded';
                uploadButton.classList.remove('btn-primary');
                uploadButton.classList.add('btn-success');
            {% endif %}
            
            uploadLabel.addEventListener('click', function() {
                fileInput.click();
            });
            
            fileInput.addEventListener('change', function() {
                if (fileInput.files.length > 0) {
                    fileName.textContent = fileInput.files[0].name;
                    fileSelected.classList.remove('d-none');
                    uploadLabel.style.borderColor = '#0d6efd';
                } else {
                    fileSelected.classList.add('d-none');
                    uploadLabel.style.borderColor = '#dee2e6';
                }
            });
            
            // Drag and drop functionality
            uploadLabel.addEventListener('dragover', function(e) {
                e.preventDefault();
                uploadLabel.style.borderColor = '#0d6efd';
                uploadLabel.style.backgroundColor = '#f1f8ff';
            });
            
            uploadLabel.addEventListener('dragleave', function(e) {
                e.preventDefault();
                uploadLabel.style.borderColor = '#dee2e6';
                uploadLabel.style.backgroundColor = '#f8f9fa';
            });
            
            uploadLabel.addEventListener('drop', function(e) {
                e.preventDefault();
                
                if (e.dataTransfer.files.length > 0) {
                    fileInput.files = e.dataTransfer.files;
                    if (fileInput.files[0].name.endsWith('.docx')) {
                        fileName.textContent = fileInput.files[0].name;
                        fileSelected.classList.remove('d-none');
                        
                        // Auto-submit the form when a file is dropped
                        document.getElementById('cv-upload-form').submit();
                    } else {
                        alert('Please upload a .docx file');
                    }
                }
                
                uploadLabel.style.borderColor = '#dee2e6';
                uploadLabel.style.backgroundColor = '#f8f9fa';
            });
        });
    </script>
</body>
</html>