Demo Talep Formu

This commit is contained in:
Sedat Öztürk 2025-05-26 21:40:51 +03:00
parent 4cba98e7a8
commit d5e3c93520
8 changed files with 141 additions and 10 deletions

View file

@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Kurs.Platform.Data.Seeds;
using Kurs.Sender.Mail;
using Volo.Abp.Settings;
using Volo.Abp.UI.Navigation.Urls;
namespace Kurs.Platform.Dashboard;
public class ContactFormDto
{
public string Company { get; set; }
public string FullName { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Address { get; set; }
public string BranchCount { get; set; }
public string UserCount { get; set; }
public string Message { get; set; }
}
public class DemoAppService : PlatformAppService
{
private readonly ISettingProvider settingProvider;
private readonly IKursEmailSender emailSender;
public DemoAppService(
ISettingProvider settingProvider,
IKursEmailSender emailSender
)
{
this.settingProvider = settingProvider;
this.emailSender = emailSender;
}
public async Task DemoFormAsync(ContactFormDto input)
{
var bodyBuilder = new StringBuilder();
bodyBuilder.AppendLine($"Şirket: {input.Company}");
bodyBuilder.AppendLine($"Ad Soyad: {input.FullName}");
bodyBuilder.AppendLine($"E-Posta: {input.Email}");
bodyBuilder.AppendLine($"Telefon: {input.Phone}");
bodyBuilder.AppendLine($"Adres: {input.Address}");
bodyBuilder.AppendLine($"Şube Sayısı: {input.BranchCount}");
bodyBuilder.AppendLine($"Kullanıcı Sayısı: {input.UserCount}");
bodyBuilder.AppendLine($"Mesaj: {input.Message}");
var SenderName = await settingProvider.GetOrNullAsync(SeedConsts.AbpSettings.Mailing.Default.DefaultFromDisplayName);
var SenderEmailAddress = await settingProvider.GetOrNullAsync(SeedConsts.AbpSettings.Mailing.Default.DefaultFromAddress);
await emailSender.QueueEmailAsync(
SenderEmailAddress,
new KeyValuePair<string, string>(SenderName, SenderEmailAddress),
null,
bodyBuilder.ToString(),
subject: PlatformConsts.AppName + " : Demo Talebi");
}
}

View file

@ -2,7 +2,7 @@
"App": {
"SelfUrl": "https://localhost:44344",
"ClientUrl": "http://localhost:3000",
"CorsOrigins": "http://localhost,http://localhost:3000,http://localhost:4200,http://localhost:5173",
"CorsOrigins": "http://localhost,http://localhost:3000,http://localhost:3003,http://localhost:4200,http://localhost:5173",
"RedirectAllowedUrls": "http://localhost:4200,http://localhost:4200/authentication/callback",
"AttachmentsPath": "C:\\Private\\Projects\\kurs-platform\\configs\\mail-queue\\attachments",
"CdnPath": "C:\\Private\\Projects\\kurs-platform\\configs\\docker\\data\\cdn",

1
company/.env Normal file
View file

@ -0,0 +1 @@
VITE_API_BASE_URL='https://localhost:44344'

1
company/.env.dev Normal file
View file

@ -0,0 +1 @@
VITE_API_BASE_URL='https://kurs-dev-api.sozsoft.com'

1
company/.env.production Normal file
View file

@ -0,0 +1 @@
VITE_API_BASE_URL='https://kurs-api.sozsoft.com'

1
company/.gitignore vendored
View file

@ -22,4 +22,3 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env

View file

@ -1,10 +1,8 @@
import React from "react";
import React, { useState } from "react";
import {
Mail,
Phone,
MapPin,
Clock,
Globe,
FileText,
Building,
CalendarDays,
@ -16,6 +14,62 @@ import { useLanguage } from "../context/LanguageContext";
const Contact: React.FC = () => {
const { t } = useLanguage();
const [formData, setFormData] = useState({
company: "",
fullName: "",
email: "",
phone: "",
address: "",
branchCount: "",
userCount: "",
message: "",
});
const handleChange = (
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
) => {
const { name, value } = e.target;
setFormData((prev: any) => ({
...prev,
[name]: value,
}));
};
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const apiUrl = `${import.meta.env.VITE_API_BASE_URL}/api/app/demo/demo-form`;
try {
const response = await fetch(apiUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(formData),
});
if (response.ok) {
alert("Form başarıyla gönderildi.");
setFormData({
company: "",
fullName: "",
email: "",
phone: "",
address: "",
branchCount: "",
userCount: "",
message: "",
});
} else {
alert("Bir hata oluştu. Lütfen tekrar deneyin.");
}
} catch (error) {
console.error("Gönderim hatası:", error);
alert("Sunucuya ulaşılamıyor.");
}
};
return (
<div className="min-h-screen bg-gray-50">
{/* Hero Section */}
@ -149,7 +203,7 @@ const Contact: React.FC = () => {
<h2 className="text-2xl font-bold text-gray-900 mb-6">
{t("demo.form.title")}
</h2>
<form className="space-y-6">
<form className="space-y-6" onSubmit={handleSubmit}>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label
@ -162,6 +216,8 @@ const Contact: React.FC = () => {
type="text"
id="company"
name="company"
value={formData.company}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -176,6 +232,8 @@ const Contact: React.FC = () => {
type="text"
id="fullName"
name="fullName"
value={formData.fullName}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -193,6 +251,8 @@ const Contact: React.FC = () => {
type="email"
id="email"
name="email"
value={formData.email}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -207,6 +267,8 @@ const Contact: React.FC = () => {
type="tel"
id="phone"
name="phone"
value={formData.phone}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -223,6 +285,8 @@ const Contact: React.FC = () => {
type="text"
id="address"
name="address"
value={formData.address}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -239,6 +303,8 @@ const Contact: React.FC = () => {
type="number"
id="branchCount"
name="branchCount"
value={formData.branchCount}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -253,6 +319,8 @@ const Contact: React.FC = () => {
type="number"
id="userCount"
name="userCount"
value={formData.userCount}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>
@ -268,7 +336,9 @@ const Contact: React.FC = () => {
<textarea
id="message"
name="message"
rows="10"
rows={10}
value={formData.message}
onChange={handleChange}
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
</div>

View file

@ -2,9 +2,8 @@ import React from "react";
import Hero from "../components/home/Hero";
import Features from "../components/home/Features";
import Solutions from "../components/home/Solutions";
import Testimonials from "../components/home/Testimonials";
// import Testimonials from "../components/home/Testimonials";
import CallToAction from "../components/home/CallToAction";
import { Code, Cpu, Globe2 } from "lucide-react";
const Home: React.FC = () => {
return (
@ -12,7 +11,7 @@ const Home: React.FC = () => {
<Hero />
<Features />
<Solutions />
<Testimonials />
{/* <Testimonials /> */}
<CallToAction />
</div>
);