Skip to content

Commit 24335f6

Browse files
adding validation for empty contact data
1 parent 72e89da commit 24335f6

2 files changed

Lines changed: 44 additions & 42 deletions

File tree

src/pages/empleos/[...page].astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import BreadcrumbContainer from "../../components/ui/breadcrumbContainer.astro";
99
export async function getStaticPaths({ paginate }) {
1010
const response = await fetch(backend_url + "api/jobs/get-all-jobs");
1111
12-
console.log(response);
13-
1412
const allJobs = await response.json();
1513
1614
let filterJobs = allJobs.sort((a, b) => new Date(b.pubDate).valueOf() - new Date(a.pubDate).valueOf());

src/pages/nuevo-empleo.astro

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,49 @@ for (const key in categories) {
1919
title="Publicar Nuevo Empleo | CuCoders"
2020
description="Atrae al mejor talento de la tecnología con nuestras ofertas de empleo en CuCoders. Publica una nueva oferta y encuentra al candidato perfecto para tu empresa. ¡Descubre cómo puedes conectarte con la comunidad de programadores de Cuba y atraer al mejor talento hoy mismo en CuCoders!"
2121
>
22-
23-
24-
<div class="lg:max-w-[58rem] mx-auto w-full md:mt-12">
25-
<div
26-
id="newJobsAlert"
27-
class="flex p-4 hidden mt-5 md:mt-0 text-sm mb-6 text-blue-800 border border-blue-300 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400 dark:border-blue-800"
28-
role="alert"
29-
>
30-
<svg
31-
aria-hidden="true"
32-
class="flex-shrink-0 inline w-5 h-5 mr-3"
33-
fill="currentColor"
34-
viewBox="0 0 20 20"
35-
xmlns="http://www.w3.org/2000/svg"
36-
><path
37-
fill-rule="evenodd"
38-
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
39-
clip-rule="evenodd"></path></svg
22+
<div class="lg:max-w-[58rem] mx-auto w-full md:mt-12">
23+
<div
24+
id="newJobsAlert"
25+
class="flex p-4 hidden mt-5 md:mt-0 text-sm mb-6 text-blue-800 border border-blue-300 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400 dark:border-blue-800"
26+
role="alert"
4027
>
41-
<span class="sr-only">Info</span>
42-
<div>
43-
<span class="font-medium">Antes de publicar su anuncio, asegúrese de respetar las siguientes normas.</span>
44-
<ul class="mt-1.5 ml-4 list-disc list-inside">
45-
<li>Solo publicar ofertas de trabajo. (No ofertas de servicios)</li>
46-
<li>No repetir el mismo anuncio en el plazo de un mes.</li>
47-
<li>No publicar ofertas de trabajos engañosas o inmorales.</li>
48-
</ul>
49-
</div>
50-
<button
51-
type="button"
52-
class="ml-auto -mx-1.5 -my-1.5 bg-blue-50 text-blue-500 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 hover:bg-blue-200 inline-flex h-8 w-8 dark:bg-gray-800 dark:text-blue-300 dark:hover:bg-gray-700"
53-
data-dismiss-target="#newJobsAlert"
54-
aria-label="Close"
55-
id="closeNewJobsAlert"
56-
>
57-
<span class="sr-only">Close</span>
58-
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
28+
<svg
29+
aria-hidden="true"
30+
class="flex-shrink-0 inline w-5 h-5 mr-3"
31+
fill="currentColor"
32+
viewBox="0 0 20 20"
33+
xmlns="http://www.w3.org/2000/svg"
5934
><path
6035
fill-rule="evenodd"
61-
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
36+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
6237
clip-rule="evenodd"></path></svg
6338
>
64-
</button>
39+
<span class="sr-only">Info</span>
40+
<div>
41+
<span class="font-medium">Antes de publicar su anuncio, asegúrese de respetar las siguientes normas.</span>
42+
<ul class="mt-1.5 ml-4 list-disc list-inside">
43+
<li>Solo publicar ofertas de trabajo. (No ofertas de servicios)</li>
44+
<li>No repetir el mismo anuncio en el plazo de un mes.</li>
45+
<li>No publicar ofertas de trabajos engañosas o inmorales.</li>
46+
</ul>
47+
</div>
48+
<button
49+
type="button"
50+
class="ml-auto -mx-1.5 -my-1.5 bg-blue-50 text-blue-500 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 hover:bg-blue-200 inline-flex h-8 w-8 dark:bg-gray-800 dark:text-blue-300 dark:hover:bg-gray-700"
51+
data-dismiss-target="#newJobsAlert"
52+
aria-label="Close"
53+
id="closeNewJobsAlert"
54+
>
55+
<span class="sr-only">Close</span>
56+
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
57+
><path
58+
fill-rule="evenodd"
59+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
60+
clip-rule="evenodd"></path></svg
61+
>
62+
</button>
63+
</div>
6564
</div>
66-
</div>
67-
6865

6966
<form
7067
id="job-form"
@@ -175,6 +172,13 @@ for (const key in categories) {
175172
async function addJob(e) {
176173
e.preventDefault();
177174
const data = createJobData();
175+
176+
// Validation rule: at least one contact method is required
177+
if (!data.applyEmail && !data.applyUrl && !data.applyTelegramUser && !data.applyPhone) {
178+
showToast("Debe ingresar al menos un método de contacto (Email, URL, Telegram o Teléfono).", true);
179+
return;
180+
}
181+
178182
disableBtn();
179183
try {
180184
const response = await fetch(backend_url + "api/jobs/new-job", { method: "POST", body: JSON.stringify(data) });

0 commit comments

Comments
 (0)