Contact.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div class="min-h-screen bg-white">
  3. <div class="container mx-auto px-4 py-12">
  4. <div class="max-w-6xl mx-auto">
  5. <!-- Header -->
  6. <div class="mb-12">
  7. <h1 class="text-4xl md:text-5xl font-display font-bold text-foreground mb-4">
  8. {{ t("footer.contact") }}
  9. </h1>
  10. <p class="text-lg text-foreground/60">
  11. {{ t("contact.subtitle") }}
  12. </p>
  13. </div>
  14. <div class="grid lg:grid-cols-2 gap-12">
  15. <!-- Contact Information -->
  16. <div>
  17. <h2 class="text-2xl font-display font-bold text-foreground mb-8">
  18. {{ t("contact.info.title") }}
  19. </h2>
  20. <div class="space-y-6">
  21. <!-- Email -->
  22. <div class="flex items-start gap-4">
  23. <div class="w-10 h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
  24. <svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  25. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
  26. </svg>
  27. </div>
  28. <div>
  29. <h3 class="font-display font-bold text-foreground mb-1">
  30. {{ t("contact.info.email.title") }}
  31. </h3>
  32. <a href="mailto:hello@radionica3d.com" class="text-foreground/70 hover:text-primary transition-colors">
  33. hello@radionica3d.com
  34. </a>
  35. <p class="text-sm text-foreground/60 mt-1">
  36. {{ t("contact.info.email.description") }}
  37. </p>
  38. </div>
  39. </div>
  40. <!-- Location -->
  41. <div class="flex items-start gap-4">
  42. <div class="w-10 h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
  43. <svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  44. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
  45. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
  46. </svg>
  47. </div>
  48. <div>
  49. <h3 class="font-display font-bold text-foreground mb-1">
  50. {{ t("contact.info.location.title") }}
  51. </h3>
  52. <p class="text-foreground/70">
  53. Herceg Novi, Montenegro
  54. </p>
  55. <p class="text-sm text-foreground/60 mt-1">
  56. {{ t("contact.info.location.description") }}
  57. </p>
  58. </div>
  59. </div>
  60. <!-- Hours -->
  61. <div class="flex items-start gap-4">
  62. <div class="w-10 h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
  63. <svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  64. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
  65. </svg>
  66. </div>
  67. <div>
  68. <h3 class="font-display font-bold text-foreground mb-1">
  69. {{ t("contact.info.hours.title") }}
  70. </h3>
  71. <p class="text-foreground/70">
  72. {{ t("contact.info.hours.schedule") }}
  73. </p>
  74. <p class="text-sm text-foreground/60 mt-1">
  75. {{ t("contact.info.hours.description") }}
  76. </p>
  77. </div>
  78. </div>
  79. <!-- Social Media -->
  80. <div class="flex items-start gap-4">
  81. <div class="w-10 h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
  82. <svg class="w-5 h-5 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  83. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
  84. </svg>
  85. </div>
  86. <div>
  87. <h3 class="font-display font-bold text-foreground mb-1">
  88. {{ t("contact.info.social.title") }}
  89. </h3>
  90. <div class="flex gap-4 mt-2">
  91. <a href="#" class="text-foreground/70 hover:text-primary transition-colors">
  92. {{ t("contact.info.social.linkedin") }}
  93. </a>
  94. <a href="#" class="text-foreground/70 hover:text-primary transition-colors">
  95. {{ t("contact.info.social.instagram") }}
  96. </a>
  97. <a href="#" class="text-foreground/70 hover:text-primary transition-colors">
  98. {{ t("contact.info.social.facebook") }}
  99. </a>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- VERSION_CHECK_1519 -->
  106. <!-- Contact Form -->
  107. <div>
  108. <h2 class="text-2xl font-display font-bold text-foreground mb-8">
  109. {{ t("contact.form.title") }}
  110. </h2>
  111. <form @submit.prevent="handleSubmit" class="space-y-6">
  112. <!-- Name -->
  113. <div>
  114. <label class="block text-sm font-bold text-foreground mb-2">
  115. {{ t("contact.form.name.label") }}
  116. </label>
  117. <input
  118. type="text"
  119. v-model="form.name"
  120. :placeholder="t('contact.form.name.placeholder')"
  121. class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-primary"
  122. required
  123. />
  124. </div>
  125. <!-- Email -->
  126. <div>
  127. <label class="block text-sm font-bold text-foreground mb-2">
  128. {{ t("contact.form.email.label") }}
  129. </label>
  130. <input
  131. type="email"
  132. v-model="form.email"
  133. :placeholder="t('contact.form.email.placeholder')"
  134. class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-primary"
  135. required
  136. />
  137. </div>
  138. <!-- Subject -->
  139. <div>
  140. <label class="block text-sm font-bold text-foreground mb-2">
  141. {{ t("contact.form.subject.label") }}
  142. </label>
  143. <select
  144. v-model="form.subject"
  145. class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-primary"
  146. required
  147. >
  148. <option value="">{{ t("contact.form.subject.placeholder") }}</option>
  149. <option value="general">{{ t("contact.form.subject.options.general") }}</option>
  150. <option value="quote">{{ t("contact.form.subject.options.quote") }}</option>
  151. <option value="support">{{ t("contact.form.subject.options.support") }}</option>
  152. <option value="careers">{{ t("contact.form.subject.options.careers") }}</option>
  153. <option value="other">{{ t("contact.form.subject.options.other") }}</option>
  154. </select>
  155. </div>
  156. <!-- Message -->
  157. <div>
  158. <label class="block text-sm font-bold text-foreground mb-2">
  159. {{ t("contact.form.message.label") }}
  160. </label>
  161. <textarea
  162. v-model="form.message"
  163. :placeholder="t('contact.form.message.placeholder')"
  164. rows="6"
  165. class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:border-primary resize-none"
  166. required
  167. ></textarea>
  168. </div>
  169. <!-- File Upload -->
  170. <div>
  171. <label class="block text-sm font-bold text-foreground mb-2">
  172. {{ t("contact.form.file.label") }}
  173. </label>
  174. <div class="border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-primary/50 transition-colors">
  175. <input
  176. type="file"
  177. ref="fileInputRef"
  178. @change="handleFileUpload"
  179. class="hidden"
  180. accept=".stl,.obj,.step,.3mf"
  181. />
  182. <div class="mb-3">
  183. <svg class="w-12 h-12 text-gray-400 mx-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  184. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
  185. </svg>
  186. </div>
  187. <p class="text-foreground/70 mb-2">
  188. {{ t("contact.form.file.description") }}
  189. </p>
  190. <button
  191. type="button"
  192. @click="fileInputRef?.click()"
  193. class="px-4 py-2 bg-gray-100 text-foreground font-bold rounded-lg hover:bg-gray-200 transition-colors"
  194. >
  195. {{ t("contact.form.file.button") }}
  196. </button>
  197. <p v-if="form.file" class="text-sm text-foreground/60 mt-3">
  198. {{ t("contact.form.file.selected", { fileName: form.file.name }) }}
  199. </p>
  200. </div>
  201. </div>
  202. <!-- Submit Button -->
  203. <button
  204. type="submit"
  205. :disabled="isSubmitting"
  206. class="w-full px-6 py-4 bg-primary text-white font-bold rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
  207. >
  208. {{ isSubmitting ? t("contact.form.submitting") : t("contact.form.submit") }}
  209. </button>
  210. </form>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </template>
  217. <script setup lang="ts">
  218. import { ref } from "vue";
  219. import { useI18n } from "vue-i18n";
  220. import { submitContactForm } from "../lib/api";
  221. const fileInputRef = ref<HTMLInputElement | null>(null);
  222. const { t } = useI18n();
  223. const form = ref({
  224. name: "",
  225. email: "",
  226. subject: "",
  227. message: "",
  228. file: null as File | null,
  229. });
  230. const isSubmitting = ref(false);
  231. const handleFileUpload = (event: Event) => {
  232. const input = event.target as HTMLInputElement;
  233. if (input.files && input.files[0]) {
  234. form.value.file = input.files[0];
  235. }
  236. };
  237. const handleSubmit = async () => {
  238. isSubmitting.value = true;
  239. try {
  240. const formData = new FormData();
  241. formData.append("name", form.value.name);
  242. formData.append("email", form.value.email);
  243. formData.append("subject", form.value.subject);
  244. formData.append("message", form.value.message);
  245. if (form.value.file) {
  246. formData.append("file", form.value.file);
  247. }
  248. await submitContactForm(formData);
  249. alert(t("contact.form.success"));
  250. form.value = { name: "", email: "", subject: "", message: "", file: null };
  251. } catch (error: any) {
  252. console.error("Contact form error:", error);
  253. alert(error.message || "Failed to send message. Please try again later.");
  254. } finally {
  255. isSubmitting.value = false;
  256. }
  257. };
  258. </script>