Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bf62c80d5 | |||
| 4cc07632f0 | |||
| 7b0017d1f4 | |||
| 1d2722b715 | |||
| bfd0aec56f | |||
| 68d578b29d | |||
| 21331b75a8 | |||
| 6395e36c62 | |||
| 87fb8c744d | |||
| 357a2ed423 | |||
| 434ed7a376 |
@@ -2,9 +2,9 @@ name: Build and Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
#branches:
|
||||
# - master
|
||||
# - main
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
/data
|
||||
db.sqlite3
|
||||
/uploads
|
||||
.DS_Store
|
||||
|
||||
Generated
+2
-1
@@ -3255,9 +3255,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-petting"
|
||||
version = "0.1.2"
|
||||
version = "0.1.7"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz",
|
||||
"cot",
|
||||
"futures",
|
||||
"multer",
|
||||
|
||||
+2
-1
@@ -1,11 +1,12 @@
|
||||
[package]
|
||||
name = "web-petting"
|
||||
version = "0.1.3"
|
||||
version = "0.1.7"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
cot = { version = "0.6.0", features = ["sqlite"] }
|
||||
chrono = "0.4"
|
||||
chrono-tz = "0.10"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_html_form = "0.4"
|
||||
password-auth = "1"
|
||||
|
||||
@@ -10,5 +10,6 @@ FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /data
|
||||
COPY --from=builder /app/target/release/web-petting /usr/local/bin/web-petting
|
||||
COPY static /app/static
|
||||
EXPOSE 3000
|
||||
CMD ["web-petting"]
|
||||
|
||||
+83
-41
@@ -109,7 +109,7 @@ fn rand_client_color() -> &'static str {
|
||||
CLIENT_COLORS[(h.finish() as usize) % CLIENT_COLORS.len()]
|
||||
}
|
||||
|
||||
fn now() -> chrono::NaiveDateTime {
|
||||
fn now_utc() -> chrono::NaiveDateTime {
|
||||
chrono::Utc::now().naive_utc()
|
||||
}
|
||||
|
||||
@@ -182,7 +182,9 @@ struct DashboardTemplate<'a> {
|
||||
lang: Lang,
|
||||
admin_name: &'a str,
|
||||
today_visits: Vec<TodayVisit>,
|
||||
recent_feedbacks: Vec<RecentFeedback>,
|
||||
feedbacks: Vec<RecentFeedback>,
|
||||
feedback_page: usize,
|
||||
feedback_total_pages: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Template)]
|
||||
@@ -260,6 +262,7 @@ struct ScheduleTemplate<'a> {
|
||||
t: &'a Translations,
|
||||
lang: Lang,
|
||||
admin_name: &'a str,
|
||||
timezone: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Template)]
|
||||
@@ -399,8 +402,8 @@ async fn setup_submit(request: Request, session: Session, db: Database) -> cot::
|
||||
password_hash: password_auth::generate_hash(&form.password),
|
||||
display_name: display,
|
||||
status: "active".to_string(),
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
user.save(&db).await?;
|
||||
|
||||
@@ -468,7 +471,8 @@ async fn admin_index(request: Request, session: Session, db: Database) -> cot::R
|
||||
Err(resp) => return Ok(resp),
|
||||
};
|
||||
let user_id = get_admin_id(&session).await.unwrap_or(0);
|
||||
let today = chrono::Utc::now().date_naive();
|
||||
let tz = crate::tz::load_tz(&db).await;
|
||||
let today = crate::tz::today_in_tz(tz);
|
||||
|
||||
let all_visits = Visit::objects().all(&db).await?;
|
||||
let clients = Client::objects().all(&db).await?;
|
||||
@@ -492,13 +496,10 @@ async fn admin_index(request: Request, session: Session, db: Database) -> cot::R
|
||||
.collect();
|
||||
today_visits.sort_by(|a, b| a.visit.time_start.cmp(&b.visit.time_start));
|
||||
|
||||
let week_ago = today - chrono::Duration::days(7);
|
||||
let mut recent_feedbacks: Vec<RecentFeedback> = all_visits
|
||||
let mut all_feedbacks: Vec<RecentFeedback> = all_visits
|
||||
.iter()
|
||||
.filter(|v| {
|
||||
v.user_id.primary_key().unwrap() == user_id
|
||||
&& v.client_feedback.is_some()
|
||||
&& v.updated_at.date() >= week_ago
|
||||
v.user_id.primary_key().unwrap() == user_id && v.client_feedback.is_some()
|
||||
})
|
||||
.map(|v| {
|
||||
let cid: i64 = v.client_id.primary_key().unwrap();
|
||||
@@ -515,14 +516,34 @@ async fn admin_index(request: Request, session: Session, db: Database) -> cot::R
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
recent_feedbacks.sort_by(|a, b| b.visit_date.cmp(&a.visit_date));
|
||||
all_feedbacks.sort_by(|a, b| b.visit_date.cmp(&a.visit_date));
|
||||
|
||||
const PER_PAGE: usize = 10;
|
||||
let feedback_page: usize = request
|
||||
.uri()
|
||||
.query()
|
||||
.and_then(|q| {
|
||||
q.split('&')
|
||||
.find_map(|p| p.strip_prefix("page="))
|
||||
.and_then(|v| v.parse().ok())
|
||||
})
|
||||
.unwrap_or(1)
|
||||
.max(1);
|
||||
let feedback_total_pages = (all_feedbacks.len() + PER_PAGE - 1).max(1) / PER_PAGE.max(1);
|
||||
let feedbacks: Vec<RecentFeedback> = all_feedbacks
|
||||
.into_iter()
|
||||
.skip((feedback_page - 1) * PER_PAGE)
|
||||
.take(PER_PAGE)
|
||||
.collect();
|
||||
|
||||
let body = DashboardTemplate {
|
||||
t: lang.t(),
|
||||
lang,
|
||||
admin_name: &admin_name,
|
||||
today_visits,
|
||||
recent_feedbacks,
|
||||
feedbacks,
|
||||
feedback_page,
|
||||
feedback_total_pages,
|
||||
}
|
||||
.render()?;
|
||||
html_response(body, lang)
|
||||
@@ -664,7 +685,7 @@ async fn client_edit_submit(
|
||||
if let Some(color) = form.color.filter(|s| !s.trim().is_empty()) {
|
||||
client.color = Some(color);
|
||||
}
|
||||
client.updated_at = now();
|
||||
client.updated_at = now_utc();
|
||||
client.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/clients?lang={}", lang.code())).into_response()
|
||||
@@ -740,8 +761,8 @@ async fn add_user(request: Request, session: Session, db: Database) -> cot::Resu
|
||||
password_hash: password_auth::generate_hash(&form.password),
|
||||
display_name: display,
|
||||
status: "active".to_string(),
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
user.save(&db).await?;
|
||||
None
|
||||
@@ -770,6 +791,8 @@ struct SettingsForm {
|
||||
telegram_chat_id: String,
|
||||
contact_info: String,
|
||||
pricing_info: String,
|
||||
timezone: String,
|
||||
site_domain: String,
|
||||
}
|
||||
|
||||
async fn save_settings(request: Request, session: Session, db: Database) -> cot::Result<Response> {
|
||||
@@ -784,13 +807,15 @@ async fn save_settings(request: Request, session: Session, db: Database) -> cot:
|
||||
("telegram_chat_id", form.telegram_chat_id),
|
||||
("contact_info", form.contact_info),
|
||||
("pricing_info", form.pricing_info),
|
||||
("timezone", form.timezone),
|
||||
("site_domain", form.site_domain),
|
||||
] {
|
||||
let k = key.to_string();
|
||||
let existing = query!(Setting, $key == k).get(&db).await?;
|
||||
match existing {
|
||||
Some(mut s) => {
|
||||
s.value = value;
|
||||
s.updated_at = now();
|
||||
s.updated_at = now_utc();
|
||||
s.save(&db).await?;
|
||||
}
|
||||
None => {
|
||||
@@ -798,7 +823,7 @@ async fn save_settings(request: Request, session: Session, db: Database) -> cot:
|
||||
id: Auto::auto(),
|
||||
key: key.to_string(),
|
||||
value,
|
||||
updated_at: now(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
s.save(&db).await?;
|
||||
}
|
||||
@@ -835,7 +860,7 @@ async fn lead_set_status(
|
||||
|
||||
if let Some(mut lead) = query!(Lead, $id == lead_id).get(&db).await? {
|
||||
lead.status = form.status;
|
||||
lead.updated_at = now();
|
||||
lead.updated_at = now_utc();
|
||||
lead.save(&db).await?;
|
||||
}
|
||||
|
||||
@@ -864,14 +889,14 @@ async fn lead_convert(
|
||||
media_token: rand_token(),
|
||||
color: Some(rand_client_color().to_string()),
|
||||
status: "active".to_string(),
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
client.save(&db).await?;
|
||||
|
||||
lead.status = "converted".to_string();
|
||||
lead.client_id = Some(ForeignKey::from(&client));
|
||||
lead.updated_at = now();
|
||||
lead.updated_at = now_utc();
|
||||
lead.save(&db).await?;
|
||||
}
|
||||
|
||||
@@ -890,7 +915,7 @@ async fn client_archive(
|
||||
}
|
||||
if let Some(mut client) = query!(Client, $id == client_id).get(&db).await? {
|
||||
client.status = "archived".to_string();
|
||||
client.updated_at = now();
|
||||
client.updated_at = now_utc();
|
||||
client.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/clients?lang={}", lang.code())).into_response()
|
||||
@@ -908,7 +933,7 @@ async fn client_activate(
|
||||
}
|
||||
if let Some(mut client) = query!(Client, $id == client_id).get(&db).await? {
|
||||
client.status = "active".to_string();
|
||||
client.updated_at = now();
|
||||
client.updated_at = now_utc();
|
||||
client.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/clients?lang={}", lang.code())).into_response()
|
||||
@@ -926,7 +951,7 @@ async fn user_archive(
|
||||
}
|
||||
if let Some(mut user) = query!(User, $id == user_id).get(&db).await? {
|
||||
user.status = "archived".to_string();
|
||||
user.updated_at = now();
|
||||
user.updated_at = now_utc();
|
||||
user.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/users?lang={}", lang.code())).into_response()
|
||||
@@ -944,7 +969,7 @@ async fn user_activate(
|
||||
}
|
||||
if let Some(mut user) = query!(User, $id == user_id).get(&db).await? {
|
||||
user.status = "active".to_string();
|
||||
user.updated_at = now();
|
||||
user.updated_at = now_utc();
|
||||
user.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/users?lang={}", lang.code())).into_response()
|
||||
@@ -972,8 +997,8 @@ async fn add_lead(request: Request, session: Session, db: Database) -> cot::Resu
|
||||
comment: form.comment.filter(|s| !s.trim().is_empty()),
|
||||
status: "new".to_string(),
|
||||
client_id: None,
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
lead.save(&db).await?;
|
||||
|
||||
@@ -1014,8 +1039,8 @@ async fn add_client(request: Request, session: Session, db: Database) -> cot::Re
|
||||
media_token: rand_token(),
|
||||
color: Some(rand_client_color().to_string()),
|
||||
status: "active".to_string(),
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
client.save(&db).await?;
|
||||
|
||||
@@ -1026,16 +1051,18 @@ async fn add_client(request: Request, session: Session, db: Database) -> cot::Re
|
||||
// Schedule Handlers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async fn schedule_page(request: Request, session: Session) -> cot::Result<Response> {
|
||||
async fn schedule_page(request: Request, session: Session, db: Database) -> cot::Result<Response> {
|
||||
let lang = detect_lang(&request);
|
||||
let admin_name = match require_auth(&session, lang).await {
|
||||
Ok(name) => name,
|
||||
Err(resp) => return Ok(resp),
|
||||
};
|
||||
let tz = crate::tz::load_tz(&db).await;
|
||||
let body = ScheduleTemplate {
|
||||
t: lang.t(),
|
||||
lang,
|
||||
admin_name: &admin_name,
|
||||
timezone: tz.to_string(),
|
||||
}
|
||||
.render()?;
|
||||
html_response(body, lang)
|
||||
@@ -1089,10 +1116,12 @@ async fn schedule_events(
|
||||
}
|
||||
}
|
||||
|
||||
let tz = crate::tz::load_tz(&db).await;
|
||||
let tz_today = crate::tz::today_in_tz(tz);
|
||||
let start_date = chrono::NaiveDate::parse_from_str(start_str, "%Y-%m-%d")
|
||||
.unwrap_or_else(|_| chrono::Utc::now().date_naive() - chrono::Duration::days(60));
|
||||
.unwrap_or_else(|_| tz_today - chrono::Duration::days(60));
|
||||
let end_date = chrono::NaiveDate::parse_from_str(end_str, "%Y-%m-%d")
|
||||
.unwrap_or_else(|_| chrono::Utc::now().date_naive() + chrono::Duration::days(60));
|
||||
.unwrap_or_else(|_| tz_today + chrono::Duration::days(60));
|
||||
|
||||
let visits = Visit::objects().all(&db).await?;
|
||||
let clients = Client::objects().all(&db).await?;
|
||||
@@ -1203,8 +1232,8 @@ async fn schedule_create(
|
||||
public_notes: None,
|
||||
client_feedback: None,
|
||||
status: "scheduled".to_string(),
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
visit.save(&db).await?;
|
||||
}
|
||||
@@ -1286,7 +1315,7 @@ async fn schedule_edit_submit(
|
||||
visit.status = form.status;
|
||||
visit.notes = form.notes.filter(|s| !s.trim().is_empty());
|
||||
visit.public_notes = form.public_notes.filter(|s| !s.trim().is_empty());
|
||||
visit.updated_at = now();
|
||||
visit.updated_at = now_utc();
|
||||
visit.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/schedule?lang={}", lang.code())).into_response()
|
||||
@@ -1318,7 +1347,7 @@ async fn visit_set_done(
|
||||
}
|
||||
if let Some(mut visit) = query!(Visit, $id == visit_id).get(&db).await? {
|
||||
visit.status = "completed".to_string();
|
||||
visit.updated_at = now();
|
||||
visit.updated_at = now_utc();
|
||||
visit.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/schedule?lang={}", lang.code())).into_response()
|
||||
@@ -1336,7 +1365,7 @@ async fn visit_set_cancel(
|
||||
}
|
||||
if let Some(mut visit) = query!(Visit, $id == visit_id).get(&db).await? {
|
||||
visit.status = "cancelled".to_string();
|
||||
visit.updated_at = now();
|
||||
visit.updated_at = now_utc();
|
||||
visit.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/schedule?lang={}", lang.code())).into_response()
|
||||
@@ -1556,12 +1585,17 @@ async fn media_upload_submit(
|
||||
file_type: ftype,
|
||||
caption: caption_opt.clone(),
|
||||
status: "active".to_string(),
|
||||
created_at: now(),
|
||||
created_at: now_utc(),
|
||||
};
|
||||
media.save(&db).await?;
|
||||
}
|
||||
|
||||
Redirect::new(format!("/admin/?lang={}", lang.code())).into_response()
|
||||
Redirect::new(format!(
|
||||
"/admin/schedule/{}/edit?lang={}",
|
||||
visit_id,
|
||||
lang.code()
|
||||
))
|
||||
.into_response()
|
||||
}
|
||||
|
||||
async fn media_delete(
|
||||
@@ -1574,11 +1608,19 @@ async fn media_delete(
|
||||
if let Err(resp) = require_auth(&session, lang).await {
|
||||
return Ok(resp);
|
||||
}
|
||||
let referer = request
|
||||
.headers()
|
||||
.get("referer")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.map(|s| s.to_string());
|
||||
if let Some(mut m) = query!(Media, $id == media_id).get(&db).await? {
|
||||
m.status = "archived".to_string();
|
||||
m.save(&db).await?;
|
||||
}
|
||||
Redirect::new(format!("/admin/media?lang={}", lang.code())).into_response()
|
||||
let redirect_url = referer
|
||||
.filter(|r| r.contains("/schedule/") && r.contains("/edit"))
|
||||
.unwrap_or_else(|| format!("/admin/media?lang={}", lang.code()));
|
||||
Redirect::new(redirect_url).into_response()
|
||||
}
|
||||
|
||||
/// Serve uploaded files by media ID.
|
||||
@@ -1759,7 +1801,7 @@ async fn testimonial_add(
|
||||
image_path,
|
||||
status: "active".to_string(),
|
||||
sort_order: max_order + 1,
|
||||
created_at: now(),
|
||||
created_at: now_utc(),
|
||||
};
|
||||
testimonial.save(&db).await?;
|
||||
}
|
||||
|
||||
+12
-6
@@ -130,6 +130,8 @@ pub struct Translations {
|
||||
pub settings_telegram_chat_id: &'static str,
|
||||
pub settings_contact_info: &'static str,
|
||||
pub settings_pricing_info: &'static str,
|
||||
pub settings_timezone: &'static str,
|
||||
pub settings_site_domain: &'static str,
|
||||
pub landing_contact_label: &'static str,
|
||||
pub landing_pricing_title: &'static str,
|
||||
|
||||
@@ -281,7 +283,7 @@ static RU: Translations = Translations {
|
||||
nav_visits: "Визиты",
|
||||
nav_users: "Админы",
|
||||
nav_settings: "Настройки",
|
||||
nav_title: "Пет-ситтинг",
|
||||
nav_title: "МурНяня.РФ",
|
||||
|
||||
leads_title: "Заявки",
|
||||
leads_empty: "Заявок пока нет.",
|
||||
@@ -338,6 +340,8 @@ static RU: Translations = Translations {
|
||||
settings_telegram_chat_id: "Chat ID для уведомлений",
|
||||
settings_contact_info: "Контактная информация (отображается на лендинге)",
|
||||
settings_pricing_info: "Блок с ценами (отображается на лендинге)",
|
||||
settings_timezone: "Часовой пояс (например Asia/Vladivostok)",
|
||||
settings_site_domain: "Домен сайта (например https://example.com)",
|
||||
landing_contact_label: "Или свяжитесь с нами напрямую",
|
||||
landing_pricing_title: "Стоимость",
|
||||
|
||||
@@ -358,7 +362,7 @@ static RU: Translations = Translations {
|
||||
media_delete_confirm: "Удалить этот файл?",
|
||||
media_all_clients: "Все клиенты",
|
||||
|
||||
portal_title: "Мои визиты",
|
||||
portal_title: "Визиты",
|
||||
portal_upcoming: "Предстоящие визиты",
|
||||
portal_past: "Прошлые визиты",
|
||||
portal_no_upcoming: "Нет предстоящих визитов.",
|
||||
@@ -448,7 +452,7 @@ static RU: Translations = Translations {
|
||||
landing_guarantee: "Порядочность, честность и строгое выполнение ваших требований гарантировано.",
|
||||
landing_testimonials_title: "Отзывы",
|
||||
landing_form_consent: "Я даю согласие на обработку персональных данных",
|
||||
landing_footer_text: "Пет-ситтинг — забота о вашем питомце",
|
||||
landing_footer_text: "МурНяня.РФ — Присмотрим, погладим, покормим",
|
||||
landing_footer_copyright: "Все права защищены",
|
||||
|
||||
nav_testimonials: "Отзывы",
|
||||
@@ -479,7 +483,7 @@ static EN: Translations = Translations {
|
||||
nav_visits: "Visits",
|
||||
nav_users: "Admins",
|
||||
nav_settings: "Settings",
|
||||
nav_title: "Pet Sitting",
|
||||
nav_title: "МурНяня.РФ",
|
||||
|
||||
leads_title: "Leads",
|
||||
leads_empty: "No leads yet.",
|
||||
@@ -536,6 +540,8 @@ static EN: Translations = Translations {
|
||||
settings_telegram_chat_id: "Notification Chat ID",
|
||||
settings_contact_info: "Contact info (shown on landing page)",
|
||||
settings_pricing_info: "Pricing block (shown on landing page)",
|
||||
settings_timezone: "Timezone (e.g. Asia/Vladivostok)",
|
||||
settings_site_domain: "Site domain (e.g. https://example.com)",
|
||||
landing_contact_label: "Or contact us directly",
|
||||
landing_pricing_title: "Pricing",
|
||||
|
||||
@@ -556,7 +562,7 @@ static EN: Translations = Translations {
|
||||
media_delete_confirm: "Delete this file?",
|
||||
media_all_clients: "All clients",
|
||||
|
||||
portal_title: "My Visits",
|
||||
portal_title: "Visits",
|
||||
portal_upcoming: "Upcoming visits",
|
||||
portal_past: "Past visits",
|
||||
portal_no_upcoming: "No upcoming visits.",
|
||||
@@ -646,7 +652,7 @@ static EN: Translations = Translations {
|
||||
landing_guarantee: "Integrity, honesty, and strict fulfillment of your requirements guaranteed.",
|
||||
landing_testimonials_title: "Testimonials",
|
||||
landing_form_consent: "I consent to the processing of my personal data",
|
||||
landing_footer_text: "Pet Sitting — caring for your pet",
|
||||
landing_footer_text: "МурНяня.РФ — Присмотрим, погладим, покормим",
|
||||
landing_footer_copyright: "All rights reserved",
|
||||
|
||||
nav_testimonials: "Testimonials",
|
||||
|
||||
@@ -4,6 +4,7 @@ mod migrations;
|
||||
pub mod models;
|
||||
mod public;
|
||||
mod telegram;
|
||||
mod tz;
|
||||
|
||||
use cot::cli::CliMetadata;
|
||||
use cot::config::{
|
||||
|
||||
+119
-5
@@ -60,7 +60,7 @@ fn html_response(body: String, lang: Lang) -> cot::Result<Response> {
|
||||
.into_response()
|
||||
}
|
||||
|
||||
fn now() -> chrono::NaiveDateTime {
|
||||
fn now_utc() -> chrono::NaiveDateTime {
|
||||
chrono::Utc::now().naive_utc()
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ struct LandingTemplate<'a> {
|
||||
contact_info: String,
|
||||
pricing_info: String,
|
||||
testimonials: Vec<Testimonial>,
|
||||
site_domain: String,
|
||||
review_count: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Template)]
|
||||
@@ -95,15 +97,24 @@ async fn landing_page(request: Request, db: Database) -> cot::Result<Response> {
|
||||
.await?
|
||||
.map(|s| s.value)
|
||||
.unwrap_or_default();
|
||||
let domain_key = "site_domain".to_string();
|
||||
let site_domain = query!(Setting, $key == domain_key)
|
||||
.get(&db)
|
||||
.await?
|
||||
.map(|s| s.value)
|
||||
.unwrap_or_else(|| "https://example.net".to_string());
|
||||
let mut testimonials = Testimonial::objects().all(&db).await?;
|
||||
testimonials.retain(|t| t.status == "active");
|
||||
testimonials.sort_by(|a, b| a.sort_order.cmp(&b.sort_order));
|
||||
let review_count = testimonials.len();
|
||||
let body = LandingTemplate {
|
||||
t: lang.t(),
|
||||
lang,
|
||||
contact_info,
|
||||
pricing_info,
|
||||
testimonials,
|
||||
site_domain,
|
||||
review_count,
|
||||
}
|
||||
.render()?;
|
||||
html_response(body, lang)
|
||||
@@ -131,8 +142,8 @@ async fn submit_lead(request: Request, db: Database) -> cot::Result<Response> {
|
||||
comment: form.comment.filter(|s| !s.trim().is_empty()),
|
||||
status: "new".to_string(),
|
||||
client_id: None,
|
||||
created_at: now(),
|
||||
updated_at: now(),
|
||||
created_at: now_utc(),
|
||||
updated_at: now_utc(),
|
||||
};
|
||||
lead.save(&db).await?;
|
||||
|
||||
@@ -188,7 +199,8 @@ async fn client_portal(
|
||||
};
|
||||
|
||||
let client_id = client.id.unwrap();
|
||||
let today = chrono::Utc::now().date_naive();
|
||||
let tz = crate::tz::load_tz(&db).await;
|
||||
let today = crate::tz::today_in_tz(tz);
|
||||
|
||||
let mut visits = Visit::objects().all(&db).await?;
|
||||
visits.retain(|v| v.client_id.primary_key().unwrap() == client_id && v.status != "cancelled");
|
||||
@@ -277,7 +289,7 @@ async fn submit_feedback(
|
||||
if let Some(mut visit) = query!(Visit, $id == visit_id).get(&db).await? {
|
||||
if visit.client_id.primary_key().unwrap() == client_id {
|
||||
visit.client_feedback = Some(form.feedback);
|
||||
visit.updated_at = now();
|
||||
visit.updated_at = now_utc();
|
||||
visit.save(&db).await?;
|
||||
}
|
||||
}
|
||||
@@ -366,9 +378,111 @@ async fn serve_testimonial_image(
|
||||
}
|
||||
}
|
||||
|
||||
async fn favicon(_request: Request) -> cot::Result<Response> {
|
||||
let svg = r##"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<ellipse cx="32" cy="42" rx="14" ry="16" fill="#7c6cff"/>
|
||||
<ellipse cx="14" cy="20" rx="7" ry="9" fill="#7c6cff" transform="rotate(-10 14 20)"/>
|
||||
<ellipse cx="50" cy="20" rx="7" ry="9" fill="#7c6cff" transform="rotate(10 50 20)"/>
|
||||
<ellipse cx="23" cy="8" rx="5.5" ry="7" fill="#7c6cff" transform="rotate(-5 23 8)"/>
|
||||
<ellipse cx="41" cy="8" rx="5.5" ry="7" fill="#7c6cff" transform="rotate(5 41 8)"/>
|
||||
</svg>"##;
|
||||
let mut resp = Response::new(cot::Body::fixed(svg.as_bytes().to_vec()));
|
||||
resp.headers_mut()
|
||||
.insert("content-type", "image/svg+xml".parse().unwrap());
|
||||
resp.headers_mut()
|
||||
.insert("cache-control", "public, max-age=604800".parse().unwrap());
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
async fn serve_static(_request: Request, Path(filename): Path<String>) -> cot::Result<Response> {
|
||||
// Only allow simple filenames (no path traversal)
|
||||
if filename.contains('/') || filename.contains('\\') || filename.contains("..") {
|
||||
return Html::new("404").into_response();
|
||||
}
|
||||
let ext = filename.rsplit('.').next().unwrap_or("");
|
||||
// Try relative path first, then /app/static/ (Docker)
|
||||
let path = format!("static/{filename}");
|
||||
let data = match tokio::fs::read(&path).await {
|
||||
Ok(d) => d,
|
||||
Err(_) => match tokio::fs::read(format!("/app/static/{filename}")).await {
|
||||
Ok(d) => d,
|
||||
Err(_) => return Html::new("404").into_response(),
|
||||
},
|
||||
};
|
||||
let content_type = match ext {
|
||||
"png" => "image/png",
|
||||
"jpg" | "jpeg" => "image/jpeg",
|
||||
"webp" => "image/webp",
|
||||
"svg" => "image/svg+xml",
|
||||
"gif" => "image/gif",
|
||||
_ => "application/octet-stream",
|
||||
};
|
||||
let body = cot::Body::fixed(data);
|
||||
let mut resp = Response::new(body);
|
||||
resp.headers_mut()
|
||||
.insert("content-type", content_type.parse().unwrap());
|
||||
resp.headers_mut()
|
||||
.insert("cache-control", "public, max-age=604800".parse().unwrap());
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
async fn robots_txt(_request: Request, db: Database) -> cot::Result<Response> {
|
||||
let domain_key = "site_domain".to_string();
|
||||
let site_domain = query!(Setting, $key == domain_key)
|
||||
.get(&db)
|
||||
.await?
|
||||
.map(|s| s.value)
|
||||
.unwrap_or_else(|| "https://example.net".to_string());
|
||||
let body = format!(
|
||||
"User-agent: *\nAllow: /\nDisallow: /admin/\nDisallow: /client/\nSitemap: {}/sitemap.xml\n",
|
||||
site_domain
|
||||
);
|
||||
let mut resp = Response::new(cot::Body::fixed(body.into_bytes()));
|
||||
resp.headers_mut()
|
||||
.insert("content-type", "text/plain; charset=utf-8".parse().unwrap());
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
async fn sitemap_xml(_request: Request, db: Database) -> cot::Result<Response> {
|
||||
let domain_key = "site_domain".to_string();
|
||||
let site_domain = query!(Setting, $key == domain_key)
|
||||
.get(&db)
|
||||
.await?
|
||||
.map(|s| s.value)
|
||||
.unwrap_or_else(|| "https://example.net".to_string());
|
||||
let body = format!(
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<url>
|
||||
<loc>{domain}/?lang=ru</loc>
|
||||
<xhtml:link rel="alternate" hreflang="ru" href="{domain}/?lang=ru"/>
|
||||
<xhtml:link rel="alternate" hreflang="en" href="{domain}/?lang=en"/>
|
||||
<xhtml:link rel="alternate" hreflang="x-default" href="{domain}/"/>
|
||||
</url>
|
||||
<url>
|
||||
<loc>{domain}/?lang=en</loc>
|
||||
<xhtml:link rel="alternate" hreflang="ru" href="{domain}/?lang=ru"/>
|
||||
<xhtml:link rel="alternate" hreflang="en" href="{domain}/?lang=en"/>
|
||||
<xhtml:link rel="alternate" hreflang="x-default" href="{domain}/"/>
|
||||
</url>
|
||||
</urlset>
|
||||
"#,
|
||||
domain = site_domain
|
||||
);
|
||||
let mut resp = Response::new(cot::Body::fixed(body.into_bytes()));
|
||||
resp.headers_mut()
|
||||
.insert("content-type", "application/xml; charset=utf-8".parse().unwrap());
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
pub fn public_router() -> Router {
|
||||
Router::with_urls([
|
||||
Route::with_handler_and_name("/", landing_page, "landing"),
|
||||
Route::with_handler_and_name("/favicon.svg", favicon, "favicon"),
|
||||
Route::with_handler_and_name("/static/{filename}", serve_static, "static-file"),
|
||||
Route::with_handler_and_name("/robots.txt", robots_txt, "robots-txt"),
|
||||
Route::with_handler_and_name("/sitemap.xml", sitemap_xml, "sitemap-xml"),
|
||||
Route::with_handler_and_name("/submit", submit_lead, "submit-lead"),
|
||||
Route::with_handler_and_name(
|
||||
"/testimonial-image/{id}",
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
use chrono_tz::Tz;
|
||||
use cot::db::{Database, query};
|
||||
|
||||
use crate::models::Setting;
|
||||
|
||||
const DEFAULT_TZ: &str = "UTC";
|
||||
|
||||
/// Load timezone from the database settings.
|
||||
pub async fn load_tz(db: &Database) -> Tz {
|
||||
let key = "timezone".to_string();
|
||||
let tz_str = query!(Setting, $key == key)
|
||||
.get(db)
|
||||
.await
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|s| s.value)
|
||||
.unwrap_or_else(|| DEFAULT_TZ.to_string());
|
||||
tz_str.parse::<Tz>().unwrap_or(Tz::UTC)
|
||||
}
|
||||
|
||||
/// Current date+time in the configured timezone, returned as NaiveDateTime.
|
||||
#[allow(dead_code)]
|
||||
pub fn now_in_tz(tz: Tz) -> chrono::NaiveDateTime {
|
||||
chrono::Utc::now().with_timezone(&tz).naive_local()
|
||||
}
|
||||
|
||||
/// Today's date in the configured timezone.
|
||||
pub fn today_in_tz(tz: Tz) -> chrono::NaiveDate {
|
||||
chrono::Utc::now().with_timezone(&tz).date_naive()
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 272 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 457 KiB |
@@ -47,19 +47,37 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Recent feedbacks -->
|
||||
<!-- Feedbacks -->
|
||||
<h2 style="font-size:1.15rem;font-weight:700;margin:1.5rem 0 0.75rem;">{{ t.dashboard_recent_feedbacks }}</h2>
|
||||
{% if recent_feedbacks.is_empty() %}
|
||||
{% if feedbacks.is_empty() %}
|
||||
<p class="has-text-grey">{{ t.dashboard_no_feedbacks }}</p>
|
||||
{% else %}
|
||||
{% for fb in &recent_feedbacks %}
|
||||
<div class="item-card" style="border-left:3px solid #7c6cff;">
|
||||
{% for fb in &feedbacks %}
|
||||
<a href="/admin/schedule/{{ fb.visit_id }}/edit?lang={{ lang.code() }}" class="item-card" style="border-left:3px solid #7c6cff;display:block;text-decoration:none;color:inherit;">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:0.25rem;">
|
||||
<strong style="font-size:0.9rem;">{{ fb.client_name }}</strong>
|
||||
<a href="/admin/schedule/{{ fb.visit_id }}/edit?lang={{ lang.code() }}" style="color:#999;font-size:0.8rem;text-decoration:none;">{{ fb.visit_date }}</a>
|
||||
<span style="color:#999;font-size:0.8rem;">{{ fb.visit_date }}</span>
|
||||
</div>
|
||||
<div style="font-size:0.85rem;color:#4a4570;">{{ fb.feedback }}</div>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
{% if feedback_total_pages > 1 %}
|
||||
<div style="display:flex;justify-content:center;gap:0.5rem;margin-top:1rem;">
|
||||
{% if feedback_page > 1 %}
|
||||
<a href="/admin/?lang={{ lang.code() }}&page={{ feedback_page - 1 }}" class="button is-small is-light">«</a>
|
||||
{% endif %}
|
||||
{% for p in 1..=feedback_total_pages %}
|
||||
{% if p == feedback_page %}
|
||||
<span class="button is-small is-primary">{{ p }}</span>
|
||||
{% else %}
|
||||
<a href="/admin/?lang={{ lang.code() }}&page={{ p }}" class="button is-small is-light">{{ p }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if feedback_page < feedback_total_pages %}
|
||||
<a href="/admin/?lang={{ lang.code() }}&page={{ feedback_page + 1 }}" class="button is-small is-light">»</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ t.nav_title }} — {% block title %}{% endblock %}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1/css/bulma.min.css">
|
||||
<style>
|
||||
:root { --accent: #6c63ff; color-scheme: light; }
|
||||
|
||||
@@ -4,11 +4,18 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ t.nav_title }} — {{ t.login_title }}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1/css/bulma.min.css">
|
||||
<style>
|
||||
body { background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
|
||||
:root { color-scheme: light; }
|
||||
body { background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; color: #333; }
|
||||
.login-box { width: 100%; max-width: 380px; padding: 0 1rem; }
|
||||
.login-card { background: #fff; border-radius: 12px; padding: 2rem 1.5rem; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
|
||||
input, textarea, select, .input, .textarea, .select select {
|
||||
background-color: #fff !important; color: #333 !important; border-color: #dbdbdb !important;
|
||||
}
|
||||
.label, label { color: #363636 !important; }
|
||||
.notification { color: #333 !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -81,6 +81,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
const calendar = new FullCalendar.Calendar(calEl, {
|
||||
locale: lang,
|
||||
timeZone: '{{ timezone }}',
|
||||
initialView: window.innerWidth < 768 ? 'listWeek' : 'dayGridMonth',
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
|
||||
@@ -97,55 +97,79 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if let Some(fb) = visit.client_feedback.as_deref() %}
|
||||
<div style="margin-bottom:1rem;">
|
||||
<label class="label">{{ t.schedule_client_feedback }}</label>
|
||||
<div style="background:#f0f0ff;border-radius:8px;padding:0.6rem 0.85rem;font-size:0.9rem;color:#4a4570;">{{ fb }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr style="margin:1rem 0;">
|
||||
|
||||
<!-- Media -->
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:0.75rem;">
|
||||
<label class="label" style="margin:0;">{{ t.nav_media }}</label>
|
||||
<button type="button" class="button is-info is-small is-outlined" onclick="document.getElementById('uploadModal').classList.add('is-open')">+ {{ t.media_upload }}</button>
|
||||
</div>
|
||||
{% if media.is_empty() %}
|
||||
<p class="has-text-grey is-size-7" style="margin-bottom:1rem;">{{ t.media_empty }}</p>
|
||||
{% else %}
|
||||
<div class="visit-media-grid">
|
||||
{% for m in &media %}
|
||||
<div class="visit-media-item">
|
||||
{% if m.file_type == "photo" %}
|
||||
<a href="/admin/uploads/{{ m.id }}" data-lightbox="photo">
|
||||
<img src="/admin/uploads/{{ m.id }}" alt="" loading="lazy">
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/admin/uploads/{{ m.id }}" data-lightbox="video">
|
||||
<div class="video-thumb-sm">🎬</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if let Some(cap) = m.caption.as_deref() %}
|
||||
<div class="media-cap">{{ cap }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr style="margin:1rem 0;">
|
||||
|
||||
<button type="submit" class="button is-primary is-fullwidth">{{ t.schedule_save }}</button>
|
||||
</form>
|
||||
|
||||
{% if let Some(fb) = visit.client_feedback.as_deref() %}
|
||||
<div style="margin-top:1rem;">
|
||||
<label class="label">{{ t.schedule_client_feedback }}</label>
|
||||
<div style="background:#f0f0ff;border-radius:8px;padding:0.6rem 0.85rem;font-size:0.9rem;color:#4a4570;">{{ fb }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr style="margin:1rem 0;">
|
||||
|
||||
<!-- Media -->
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:0.75rem;">
|
||||
<label class="label" style="margin:0;">{{ t.nav_media }}</label>
|
||||
<a href="/admin/media/{{ visit.id }}/upload?lang={{ lang.code() }}" class="button is-info is-small is-outlined">📷 {{ t.media_upload }}</a>
|
||||
</div>
|
||||
{% if media.is_empty() %}
|
||||
<p class="has-text-grey is-size-7" style="margin-bottom:1rem;">{{ t.media_empty }}</p>
|
||||
{% else %}
|
||||
<div class="visit-media-grid">
|
||||
{% for m in &media %}
|
||||
<div class="visit-media-item">
|
||||
{% if m.file_type == "photo" %}
|
||||
<a href="/admin/uploads/{{ m.id }}" data-lightbox="photo">
|
||||
<img src="/admin/uploads/{{ m.id }}" alt="" loading="lazy">
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/admin/uploads/{{ m.id }}" data-lightbox="video">
|
||||
<div class="video-thumb-sm">🎬</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if let Some(cap) = m.caption.as_deref() %}
|
||||
<div class="media-cap">{{ cap }}</div>
|
||||
{% endif %}
|
||||
<form method="post" action="/admin/media/{{ m.id }}/delete" onsubmit="return confirm('{{ t.media_delete_confirm }}');" style="text-align:center;">
|
||||
<button class="button is-danger is-outlined btn-sm" style="font-size:0.7rem;padding:0.15rem 0.4rem;">{{ t.media_delete }}</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr style="margin:1rem 0;">
|
||||
<form method="post" action="/admin/schedule/{{ visit.id }}/delete" onsubmit="return confirm('{{ t.schedule_delete_confirm }}');">
|
||||
<button type="submit" class="button is-danger is-outlined is-fullwidth is-small">{{ t.schedule_delete }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Upload Modal -->
|
||||
<div class="upload-modal-bg" id="uploadModal">
|
||||
<div class="upload-modal">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;">
|
||||
<h3 style="font-size:1.1rem;font-weight:700;margin:0;">{{ t.media_upload_title }}</h3>
|
||||
<button type="button" style="background:none;border:none;font-size:1.2rem;cursor:pointer;color:#888;" onclick="document.getElementById('uploadModal').classList.remove('is-open')">✕</button>
|
||||
</div>
|
||||
<form method="post" action="/admin/media/{{ visit.id }}/upload/submit" enctype="multipart/form-data">
|
||||
<div class="field">
|
||||
<label class="label">{{ t.media_choose_files }}</label>
|
||||
<div class="control">
|
||||
<input class="input" type="file" name="files" multiple accept="image/*,video/*" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">{{ t.media_caption }}</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" name="caption" placeholder="{{ t.media_caption }}">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="button is-primary is-fullwidth">{{ t.media_upload }}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.visit-media-grid {
|
||||
display: grid;
|
||||
@@ -182,8 +206,31 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.visit-media-item form {
|
||||
padding: 0.2rem;
|
||||
.upload-modal-bg {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.35);
|
||||
z-index: 100;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.upload-modal-bg.is-open {
|
||||
display: flex;
|
||||
}
|
||||
.upload-modal {
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem;
|
||||
width: 90%;
|
||||
max-width: 420px;
|
||||
box-shadow: 0 4px 24px rgba(0,0,0,0.15);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.getElementById('uploadModal').addEventListener('click', function(e) {
|
||||
if (e.target === this) this.classList.remove('is-open');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -38,6 +38,18 @@
|
||||
<textarea class="input" name="pricing_info" rows="3" style="min-height:70px;resize:vertical;" placeholder="от 600 рублей за визит">{% for s in &settings %}{% if s.key == "pricing_info" %}{{ s.value }}{% endif %}{% endfor %}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">{{ t.settings_site_domain }}</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" name="site_domain" placeholder="https://example.com" value="{% for s in &settings %}{% if s.key == "site_domain" %}{{ s.value }}{% endif %}{% endfor %}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">{{ t.settings_timezone }}</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" name="timezone" placeholder="Asia/Vladivostok" value="{% for s in &settings %}{% if s.key == "timezone" %}{{ s.value }}{% endif %}{% endfor %}">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="button is-primary">{{ t.settings_save }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -4,11 +4,18 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ t.nav_title }} — {{ t.setup_title }}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1/css/bulma.min.css">
|
||||
<style>
|
||||
body { background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
|
||||
:root { color-scheme: light; }
|
||||
body { background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; color: #333; }
|
||||
.login-box { width: 100%; max-width: 400px; padding: 0 1rem; }
|
||||
.login-card { background: #fff; border-radius: 12px; padding: 2rem 1.5rem; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
|
||||
input, textarea, select, .input, .textarea, .select select {
|
||||
background-color: #fff !important; color: #333 !important; border-color: #dbdbdb !important;
|
||||
}
|
||||
.label, label { color: #363636 !important; }
|
||||
.notification { color: #333 !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ t.portal_title }} — {{ client.name }}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<style>
|
||||
:root { color-scheme: light; }
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
@@ -54,6 +56,7 @@
|
||||
.feedback-form textarea {
|
||||
width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 8px;
|
||||
font-size: 0.85rem; font-family: inherit; resize: vertical; min-height: 50px;
|
||||
background-color: #fff; color: #333;
|
||||
}
|
||||
.feedback-form textarea:focus { outline: none; border-color: #7c6cff; }
|
||||
.feedback-form button {
|
||||
|
||||
+57
-7
@@ -5,11 +5,26 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="{{ t.landing_meta_description }}">
|
||||
<title>{{ t.nav_title }} — {{ t.landing_hero_title }}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
|
||||
<!-- Canonical & Hreflang -->
|
||||
<link rel="canonical" href="{{ site_domain }}/?lang={{ lang.code() }}">
|
||||
<link rel="alternate" hreflang="ru" href="{{ site_domain }}/?lang=ru">
|
||||
<link rel="alternate" hreflang="en" href="{{ site_domain }}/?lang=en">
|
||||
<link rel="alternate" hreflang="x-default" href="{{ site_domain }}/">
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:title" content="{{ t.nav_title }} — {{ t.landing_hero_title }}">
|
||||
<meta property="og:description" content="{{ t.landing_meta_description }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="{{ site_domain }}/?lang={{ lang.code() }}">
|
||||
<meta property="og:locale" content="{% if lang.code() == "ru" %}ru_RU{% else %}en_US{% endif %}">
|
||||
<meta property="og:site_name" content="{{ t.nav_title }}">
|
||||
|
||||
<!-- Twitter Card -->
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="{{ t.nav_title }} — {{ t.landing_hero_title }}">
|
||||
<meta name="twitter:description" content="{{ t.landing_meta_description }}">
|
||||
|
||||
<!-- Structured Data -->
|
||||
<script type="application/ld+json">
|
||||
@@ -19,7 +34,15 @@
|
||||
"name": "{{ t.nav_title }}",
|
||||
"description": "{{ t.landing_meta_description }}",
|
||||
"serviceType": "Pet Sitting",
|
||||
"@id": "#business"
|
||||
"url": "{{ site_domain }}/",
|
||||
"@id": "#business"{% if review_count > 0 %},
|
||||
"aggregateRating": {
|
||||
"@type": "AggregateRating",
|
||||
"ratingValue": "5",
|
||||
"bestRating": "5",
|
||||
"ratingCount": "{{ review_count }}",
|
||||
"reviewCount": "{{ review_count }}"
|
||||
}{% endif %}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -96,6 +119,25 @@
|
||||
box-shadow: 0 4px 20px rgba(124,108,255,0.35);
|
||||
}
|
||||
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(124,108,255,0.45); }
|
||||
.hero { position: relative; overflow: clip; }
|
||||
.hero-photo {
|
||||
position: absolute; z-index: 0;
|
||||
width: 420px; height: 420px;
|
||||
border-radius: 50%;
|
||||
border: 20px solid #ffe0ec;
|
||||
object-fit: cover;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.hero-photo-tr { right: -100px; top: -100px; }
|
||||
.hero-photo-bl { left: -100px; bottom: -150px; }
|
||||
.hero-content { position: relative; z-index: 1; }
|
||||
.section-alt { position: relative; z-index: 1; }
|
||||
@media (max-width: 600px) {
|
||||
.hero-photo { width: 200px; height: 200px; border-width: 12px; }
|
||||
.hero-photo-tr { right: -50px; top: -50px; }
|
||||
.hero-photo-bl { left: -50px; bottom: -70px; }
|
||||
.hero-cta { display: block; width: fit-content; margin-left: auto; margin-right: 0; }
|
||||
}
|
||||
.hero-emoji { font-size: 4rem; margin-bottom: 1rem; display: block; }
|
||||
.hero-desc {
|
||||
font-size: clamp(0.9rem, 2vw, 1.05rem);
|
||||
@@ -118,6 +160,7 @@
|
||||
border-radius: 18px; padding: 1.75rem;
|
||||
border: 1px solid rgba(180,170,220,0.2);
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
-webkit-transform: translateZ(0); transform: translateZ(0);
|
||||
}
|
||||
.testimonial-card:hover {
|
||||
transform: translateY(-3px);
|
||||
@@ -147,6 +190,7 @@
|
||||
border-radius: 18px; padding: 2rem 2.5rem;
|
||||
border: 1px solid rgba(180,170,220,0.2);
|
||||
text-align: center;
|
||||
-webkit-transform: translateZ(0); transform: translateZ(0);
|
||||
}
|
||||
.pricing-text {
|
||||
font-size: clamp(1.1rem, 2.5vw, 1.3rem);
|
||||
@@ -177,12 +221,13 @@
|
||||
border-radius: 18px; padding: 2rem 1.75rem;
|
||||
border: 1px solid rgba(180,170,220,0.2);
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
-webkit-transform: translateZ(0); transform: translateZ(0);
|
||||
}
|
||||
.service-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 36px rgba(124,108,255,0.12);
|
||||
}
|
||||
.service-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
|
||||
.service-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; text-align: center; }
|
||||
.service-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; color: #2d2b55; }
|
||||
.service-card p { color: #5a5680; font-size: 0.95rem; line-height: 1.6; }
|
||||
|
||||
@@ -210,6 +255,7 @@
|
||||
border-radius: 22px; padding: 2.5rem 2rem;
|
||||
box-shadow: 0 8px 40px rgba(124,108,255,0.12);
|
||||
border: 1px solid rgba(180,170,220,0.25);
|
||||
-webkit-transform: translateZ(0); transform: translateZ(0);
|
||||
}
|
||||
.form-wrapper h2 {
|
||||
text-align: center; font-size: 1.6rem; font-weight: 800;
|
||||
@@ -286,11 +332,15 @@
|
||||
|
||||
<!-- Hero -->
|
||||
<section class="hero">
|
||||
<span class="hero-emoji" role="img" aria-label="pets">🐱🐹🦎</span>
|
||||
<h1>{{ t.landing_hero_title }}</h1>
|
||||
<p>{{ t.landing_hero_subtitle }}</p>
|
||||
<p class="hero-desc">{{ t.landing_hero_description }}</p>
|
||||
<a href="#form" class="hero-cta">{{ t.landing_hero_cta }}</a>
|
||||
<img class="hero-photo hero-photo-tr" src="/static/cat_up_right.png" alt="">
|
||||
<img class="hero-photo hero-photo-bl" src="/static/cat_bottom_left.png" alt="">
|
||||
<div class="hero-content">
|
||||
<span class="hero-emoji" role="img" aria-label="pets">🐱🐹🦎</span>
|
||||
<h1>{{ t.landing_hero_title }}</h1>
|
||||
<p>{{ t.landing_hero_subtitle }}</p>
|
||||
<p class="hero-desc">{{ t.landing_hero_description }}</p>
|
||||
<a href="#form" class="hero-cta">{{ t.landing_hero_cta }}</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Services -->
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ t.nav_title }} — {{ t.landing_thank_you_title }}</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<style>
|
||||
:root { color-scheme: light; }
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
|
||||
|
||||
Reference in New Issue
Block a user