diff --git a/main/models.py b/main/models.py index ff3fb2436dd6094e6747c7df70f73eb89f4a2c1a..37cb767bba7c6963dc92e250d923f5f2d4e0a06d 100644 --- a/main/models.py +++ b/main/models.py @@ -561,8 +561,9 @@ class MainCareerPage( form = None current_time = datetime.now() + current_date = current_time.date() - if request.method == "POST": + if request.method == "POST" and self.closing_date > current_date and self.submission_end_date > current_date: form = CareerSubmissionForm(request.POST, request.FILES) if form.is_valid(): diff --git a/main/templates/main/main_career_page.html b/main/templates/main/main_career_page.html index 765d25777c448e95e76a02c689fcaf432f4215c5..ec22f71c03bd1af450c81b3cb15cdc63f9593451 100644 --- a/main/templates/main/main_career_page.html +++ b/main/templates/main/main_career_page.html @@ -13,6 +13,10 @@ <main role="main"> <section class="container--wide mb-4 xl:mb-20"> {% if page.closing_date <= current_date %} + <div class="bg-red-400 border border-solid border-red-600 p-4 inline-block mb-6"> + <strong>VĂ˝bÄ›rovĂ© Ĺ™ĂzenĂ uzavĹ™eno.</strong> + </div> + {% elif page.submission_end_date <= current_date %} <div class="bg-red-400 border border-solid border-red-600 p-4 inline-block mb-6"> <strong>PĹ™ihlášky uzavĹ™eny.</strong> </div> @@ -49,125 +53,129 @@ </div> {% endif %} - <div data-micromodal-trigger="modal-1" class="lg:mb-3 mb-12"> - {% include "styleguide2/includes/atoms/buttons/round_button.html" with text="PĹ™ihlásit se" show_arrow_on_hover=True %} - </div> + {% if page.closing_date > current_date and page.submission_end_date > current_date %} + <div data-micromodal-trigger="modal-1" class="lg:mb-3 mb-12 inline-block"> + {% include "styleguide2/includes/atoms/buttons/round_button.html" with text="PĹ™ihlásit se" show_arrow_on_hover=True %} + </div> + {% endif %} </section> </main> - <div class="modal micromodal-slide" id="modal-1" aria-hidden="true"> - <div class="modal__overlay" tabindex="-1"> - <form - class="modal__container" - role="dialog" - aria-modal="true" - aria-labelledby="modal-1-title" - enctype="multipart/form-data" - method="POST" - action="" - > - <header class="modal__header"> - <h2 class="modal__title" id="modal-1-title"> - PĹ™ihlásit se - </h2> - <button class="modal__close" aria-label="Close modal" data-micromodal-close></button> - </header> - <main class="modal__content mb-6" id="modal-1-content"> - <div class="form_control"> - <section - class=" - flex gap-4 flex-nowrap flex-col w-full - - lg:flex-row lg:gap-2 - " - > - {% csrf_token %} - - <div class="lg:w-auto w-full"> - {{ form.name }} - </div> - <div class="lg:w-auto w-full"> - {{ form.surname }} - </div> - </section> - <section> - <div class="w-full"> - {{ form.email }} - </div> - </section> - <section> - <div class="w-full"> - {{ form.phone }} - </div> - </section> - <section> - <div class="w-full"> - {{ form.own_text }} - </div> - </section> - <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> - <label - class="w-36" - for="id_cv" - id="cv_label" - >CV: </label> - - {{ form.cv_file }} - - <small class="text-grey-300">(PovinnĂ©, max. 5 MB)</small> - </section> - <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> - <label - class="w-36" - id="cover_letter_label" - for="id_cover_letter_file" - >Mot. dopis: </label> - - {{ form.cover_letter_file }} - - <small class="text-grey-300">(PovinnĂ˝, max. 5 MB)</small> - </section> - <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> - <label - class="w-36" - id="other_files_label" - for="id_other_files" - >OstatnĂ soubory: </label> - - <div class="flex flex-col gap-2"> - {{ form.other_files }} - - <small class="text-grey-300"> - (Max. 5 MB na jeden soubor, 5 MB celkem) - </small> - </div> - </section> - - <section class="flex flex-row gap-3 items-start leading-none"> - {{ form.personal_data_agreement }} - - <label - for="id_personal_data_agreement" - >SouhlasĂm se zpracovánĂm osobnĂm ĂşdajĹŻ (povinnĂ©)</label> - </section> - </div> - </main> - <footer - class=" - modal__footer flex gap-2 justify-end flex-col items-end - - lg:items-start lg:gap-4 lg:flex-row - " + {% if page.closing_date > current_date and page.submission_end_date > current_date %} + <div class="modal micromodal-slide" id="modal-1" aria-hidden="true"> + <div class="modal__overlay" tabindex="-1"> + <form + class="modal__container" + role="dialog" + aria-modal="true" + aria-labelledby="modal-1-title" + enctype="multipart/form-data" + method="POST" + action="" > - <div data-micromodal-close> - {% include "styleguide2/includes/atoms/buttons/round_button_form.html" with type="button" text="Zrušit" show_arrow_on_hover=True %} - </div> - <div> - {% include "styleguide2/includes/atoms/buttons/round_button_form.html" with type="submit" fill="#fff" classes="bg-pirati-yellow text-black" text="Odeslat pĹ™ihlášku" show_arrow_on_hover=True %} - </div> - </footer> - </form> + <header class="modal__header"> + <h2 class="modal__title" id="modal-1-title"> + PĹ™ihlásit se + </h2> + <button class="modal__close" aria-label="Close modal" data-micromodal-close></button> + </header> + <main class="modal__content mb-6" id="modal-1-content"> + <div class="form_control"> + <section + class=" + flex gap-4 flex-nowrap flex-col w-full + + lg:flex-row lg:gap-2 + " + > + {% csrf_token %} + + <div class="lg:w-auto w-full"> + {{ form.name }} + </div> + <div class="lg:w-auto w-full"> + {{ form.surname }} + </div> + </section> + <section> + <div class="w-full"> + {{ form.email }} + </div> + </section> + <section> + <div class="w-full"> + {{ form.phone }} + </div> + </section> + <section> + <div class="w-full"> + {{ form.own_text }} + </div> + </section> + <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> + <label + class="w-36" + for="id_cv" + id="cv_label" + >CV: </label> + + {{ form.cv_file }} + + <small class="text-grey-300">(PovinnĂ©, max. 5 MB)</small> + </section> + <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> + <label + class="w-36" + id="cover_letter_label" + for="id_cover_letter_file" + >Mot. dopis: </label> + + {{ form.cover_letter_file }} + + <small class="text-grey-300">(PovinnĂ˝, max. 5 MB)</small> + </section> + <section class="flex flex-col gap-3 lg:items-center lg:flex-row"> + <label + class="w-36" + id="other_files_label" + for="id_other_files" + >OstatnĂ soubory: </label> + + <div class="flex flex-col gap-2"> + {{ form.other_files }} + + <small class="text-grey-300"> + (Max. 5 MB na jeden soubor, 5 MB celkem) + </small> + </div> + </section> + + <section class="flex flex-row gap-3 items-start leading-none"> + {{ form.personal_data_agreement }} + + <label + for="id_personal_data_agreement" + >SouhlasĂm se zpracovánĂm osobnĂm ĂşdajĹŻ (povinnĂ©)</label> + </section> + </div> + </main> + <footer + class=" + modal__footer flex gap-2 justify-end flex-col items-end + + lg:items-start lg:gap-4 lg:flex-row + " + > + <div data-micromodal-close> + {% include "styleguide2/includes/atoms/buttons/round_button_form.html" with type="button" text="Zrušit" show_arrow_on_hover=True %} + </div> + <div> + {% include "styleguide2/includes/atoms/buttons/round_button_form.html" with type="submit" fill="#fff" classes="bg-pirati-yellow text-black" text="Odeslat pĹ™ihlášku" show_arrow_on_hover=True %} + </div> + </footer> + </form> + </div> </div> - </div> + {% endif %} {% endblock %}