diff --git a/package.json b/package.json index d477a0c..d6e273d 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@payloadcms/db-postgres": "^3.35.1", "@payloadcms/next": "^3.35.1", "@payloadcms/payload-cloud": "^3.35.1", + "@payloadcms/plugin-form-builder": "^3.35.1", "@payloadcms/richtext-lexical": "^3.35.1", "@payloadcms/storage-s3": "^3.35.1", "country-state-city": "^3.2.1", @@ -25,7 +26,9 @@ "qs-esm": "^7.0.2", "react": "^19.0.0", "react-dom": "^19.0.0", + "react-hook-form": "^7.56.1", "react-select": "^5.10.1", + "react-toastify": "^11.0.5", "swiper": "^11.2.6" }, "devDependencies": { diff --git a/public/js/script.js b/public/js/script.js index 54c4c26..3e0ad30 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1482,168 +1482,168 @@ $(function () { } // Select2 - if (plugins.selectFilter.length) { - var i; - for (i = 0; i < plugins.selectFilter.length; i++) { - var select = $(plugins.selectFilter[i]); + // if (plugins.selectFilter.length) { + // var i; + // for (i = 0; i < plugins.selectFilter.length; i++) { + // var select = $(plugins.selectFilter[i]); - select.select2({ - placeholder: select.attr("data-placeholder") ? select.attr("data-placeholder") : false, - minimumResultsForSearch: select.attr("data-minimum-results-search") ? select.attr("data-minimum-results-search") : -1, - maximumSelectionSize: 3, - dropdownCssClass: select.attr("data-class") ? select.attr("data-class") : '' - }); - } - } + // select.select2({ + // placeholder: select.attr("data-placeholder") ? select.attr("data-placeholder") : false, + // minimumResultsForSearch: select.attr("data-minimum-results-search") ? select.attr("data-minimum-results-search") : -1, + // maximumSelectionSize: 3, + // dropdownCssClass: select.attr("data-class") ? select.attr("data-class") : '' + // }); + // } + // } // RD Mailform - if (plugins.rdMailForm.length) { - var i, j, k, - msg = { - 'MF000': 'Successfully sent!', - 'MF001': 'Recipients are not set!', - 'MF002': 'Form will not work locally!', - 'MF003': 'Please, define email field in your form!', - 'MF004': 'Please, define type of your form!', - 'MF254': 'Something went wrong with PHPMailer!', - 'MF255': 'Aw, snap! Something went wrong.' - }; + // if (plugins.rdMailForm.length) { + // var i, j, k, + // msg = { + // 'MF000': 'Successfully sent!', + // 'MF001': 'Recipients are not set!', + // 'MF002': 'Form will not work locally!', + // 'MF003': 'Please, define email field in your form!', + // 'MF004': 'Please, define type of your form!', + // 'MF254': 'Something went wrong with PHPMailer!', + // 'MF255': 'Aw, snap! Something went wrong.' + // }; - for (i = 0; i < plugins.rdMailForm.length; i++) { - var $form = $(plugins.rdMailForm[i]), - formHasCaptcha = false; + // for (i = 0; i < plugins.rdMailForm.length; i++) { + // var $form = $(plugins.rdMailForm[i]), + // formHasCaptcha = false; - $form.attr('novalidate', 'novalidate').ajaxForm({ - data: { - "form-type": $form.attr("data-form-type") || "contact", - "counter": i - }, - beforeSubmit: function (arr, $form, options) { - if (isNoviBuilder) - return; + // $form.attr('novalidate', 'novalidate').ajaxForm({ + // data: { + // "form-type": $form.attr("data-form-type") || "contact", + // "counter": i + // }, + // beforeSubmit: function (arr, $form, options) { + // if (isNoviBuilder) + // return; - var form = $(plugins.rdMailForm[this.extraData.counter]), - inputs = form.find("[data-constraints]"), - output = $("#" + form.attr("data-form-output")), - captcha = form.find('.recaptcha'), - captchaFlag = true; + // var form = $(plugins.rdMailForm[this.extraData.counter]), + // inputs = form.find("[data-constraints]"), + // output = $("#" + form.attr("data-form-output")), + // captcha = form.find('.recaptcha'), + // captchaFlag = true; - output.removeClass("active error success"); + // output.removeClass("active error success"); - if (isValidated(inputs, captcha)) { + // if (isValidated(inputs, captcha)) { - // veify reCaptcha - if (captcha.length) { - var captchaToken = captcha.find('.g-recaptcha-response').val(), - captchaMsg = { - 'CPT001': 'Please, setup you "site key" and "secret key" of reCaptcha', - 'CPT002': 'Something wrong with google reCaptcha' - }; + // // veify reCaptcha + // if (captcha.length) { + // var captchaToken = captcha.find('.g-recaptcha-response').val(), + // captchaMsg = { + // 'CPT001': 'Please, setup you "site key" and "secret key" of reCaptcha', + // 'CPT002': 'Something wrong with google reCaptcha' + // }; - formHasCaptcha = true; + // formHasCaptcha = true; - $.ajax({ - method: "POST", - url: "bat/reCaptcha.php", - data: { 'g-recaptcha-response': captchaToken }, - async: false - }) - .done(function (responceCode) { - if (responceCode !== 'CPT000') { - if (output.hasClass("snackbars")) { - output.html('
' + captchaMsg[responceCode] + '
') + // $.ajax({ + // method: "POST", + // url: "bat/reCaptcha.php", + // data: { 'g-recaptcha-response': captchaToken }, + // async: false + // }) + // .done(function (responceCode) { + // if (responceCode !== 'CPT000') { + // if (output.hasClass("snackbars")) { + // output.html('' + captchaMsg[responceCode] + '
') - setTimeout(function () { - output.removeClass("active"); - }, 3500); + // setTimeout(function () { + // output.removeClass("active"); + // }, 3500); - captchaFlag = false; - } else { - output.html(captchaMsg[responceCode]); - } + // captchaFlag = false; + // } else { + // output.html(captchaMsg[responceCode]); + // } - output.addClass("active"); - } - }); - } + // output.addClass("active"); + // } + // }); + // } - if (!captchaFlag) { - return false; - } + // if (!captchaFlag) { + // return false; + // } - form.addClass('form-in-process'); + // form.addClass('form-in-process'); - if (output.hasClass("snackbars")) { - output.html('Sending
'); - output.addClass("active"); - } - } else { - return false; - } - }, - error: function (result) { - if (isNoviBuilder) - return; + // if (output.hasClass("snackbars")) { + // output.html('Sending
'); + // output.addClass("active"); + // } + // } else { + // return false; + // } + // }, + // error: function (result) { + // if (isNoviBuilder) + // return; - var output = $("#" + $(plugins.rdMailForm[this.extraData.counter]).attr("data-form-output")), - form = $(plugins.rdMailForm[this.extraData.counter]); + // var output = $("#" + $(plugins.rdMailForm[this.extraData.counter]).attr("data-form-output")), + // form = $(plugins.rdMailForm[this.extraData.counter]); - output.text(msg[result]); - form.removeClass('form-in-process'); + // output.text(msg[result]); + // form.removeClass('form-in-process'); - if (formHasCaptcha) { - grecaptcha.reset(); - } - }, - success: function (result) { - if (isNoviBuilder) - return; + // if (formHasCaptcha) { + // grecaptcha.reset(); + // } + // }, + // success: function (result) { + // if (isNoviBuilder) + // return; - var form = $(plugins.rdMailForm[this.extraData.counter]), - output = $("#" + form.attr("data-form-output")), - select = form.find('select'); + // var form = $(plugins.rdMailForm[this.extraData.counter]), + // output = $("#" + form.attr("data-form-output")), + // select = form.find('select'); - form - .addClass('success') - .removeClass('form-in-process'); + // form + // .addClass('success') + // .removeClass('form-in-process'); - if (formHasCaptcha) { - grecaptcha.reset(); - } + // if (formHasCaptcha) { + // grecaptcha.reset(); + // } - result = result.length === 5 ? result : 'MF255'; - output.text(msg[result]); + // result = result.length === 5 ? result : 'MF255'; + // output.text(msg[result]); - if (result === "MF000") { - if (output.hasClass("snackbars")) { - output.html('' + msg[result] + '
'); - } else { - output.addClass("active success"); - } - } else { - if (output.hasClass("snackbars")) { - output.html(' '); - } else { - output.addClass("active error"); - } - } + // if (result === "MF000") { + // if (output.hasClass("snackbars")) { + // output.html('' + msg[result] + '
'); + // } else { + // output.addClass("active success"); + // } + // } else { + // if (output.hasClass("snackbars")) { + // output.html(' '); + // } else { + // output.addClass("active error"); + // } + // } - form.clearForm(); + // form.clearForm(); - if (select.length) { - select.select2("val", ""); - } + // if (select.length) { + // select.select2("val", ""); + // } - form.find('input, textarea').trigger('blur'); + // form.find('input, textarea').trigger('blur'); - setTimeout(function () { - output.removeClass("active error success"); - form.removeClass('success'); - }, 3500); - } - }); - } - } + // setTimeout(function () { + // output.removeClass("active error success"); + // form.removeClass('success'); + // }, 3500); + // } + // }); + // } + // } // RD Filepicker if ((plugins.filePicker.length || plugins.fileDrop.length) && !isNoviBuilder) { diff --git a/src/app/(main)/globals.css b/src/app/(main)/globals.css index 29b5ab8..f7699f9 100644 --- a/src/app/(main)/globals.css +++ b/src/app/(main)/globals.css @@ -41,6 +41,9 @@ .rd-nav-link-custom { @apply text-colorHeader! lg:text-colorHeaderText! lg:hover:text-colorHeaderTextHover! } + .rd-nav-link-custom.active { + @apply text-colorHeader! lg:text-colorHeaderTextHover! lg:hover:text-colorHeaderTextHover! + } } @media (prefers-color-scheme: dark) { diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 0592a8a..057ca7e 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -6,6 +6,7 @@ import { getDefaultMetadata } from "@/utils/metadata"; import Header from "@/components/layouts/Header"; import Footer from "@/components/layouts/Footer"; import Image from "next/image"; +import { ToastContainer } from "react-toastify"; const geistSans = Geist({ variable: "--font-geist-sans", @@ -86,7 +87,8 @@ export default function RootLayout({ - +