rents_screen.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { formscreen } from "./formscreen.js";
  2. export class rents_screen extends formscreen {
  3. #target;
  4. #email;
  5. #phone;
  6. get _email() {
  7. return this.#email();
  8. }
  9. get _phone() {
  10. return this.#phone();
  11. }
  12. constructor(target) {
  13. super();
  14. this.#target = target;
  15. }
  16. get _target() {
  17. return this.#target;
  18. }
  19. _build_form() {
  20. this.#email = this._create_input(
  21. "email",
  22. _("email-prompt"),
  23. _("email-sample"),
  24. (input) => {
  25. input.type = "email";
  26. }
  27. );
  28. this.#phone = this._create_input(
  29. "phone",
  30. _("phone-number-prompt"),
  31. _("phone-number-sample"),
  32. (input) => {
  33. input.type = "tel";
  34. const add_prefix = () => {
  35. if (input.value.length === 0) {
  36. input.value = "+48 ";
  37. }
  38. };
  39. input.addEventListener("click", add_prefix);
  40. input.addEventListener("focus", add_prefix);
  41. }
  42. );
  43. }
  44. }