Files
gzth/yuthon_catering/templates/templates.xml
T
2025-12-04 00:12:38 +08:00

348 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="yuthon_catering_template" name="Catering Form Page">
<!-- 自定义CSS样式 -->
<style>
:root {
--primary-color: #4f46e5;
--primary-light: #e0e7ff;
--success-color: #10b981;
--warning-color: #f59e0b;
--info-color: #3b82f6;
--light-bg: #f8fafc;
--card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
--card-radius: 5px;
--transition: all 0.3s ease;
}
.catering-container {
max-width: 700px;
margin: 2rem auto;
padding: 0 1rem;
}
.page-header {
text-align: center;
margin-bottom: 2.5rem;
padding: 1.5rem;
background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
border-radius: var(--card-radius);
color: white;
box-shadow: var(--card-shadow);
position: relative;
overflow: hidden;
}
.page-header::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
background-size: 30px 30px;
opacity: 0.3;
animation: float 20s linear infinite;
}
@keyframes float {
0% { transform: translate(0, 0) rotate(0deg); }
100% { transform: translate(-30px, -30px) rotate(360deg); }
}
.page-title {
font-size: 2.2rem;
font-weight: 800;
margin-bottom: 0.5rem;
position: relative;
display: inline-block;
}
.page-subtitle {
font-size: 1rem;
opacity: 0.9;
font-weight: 400;
}
.form-card {
background: white;
border-radius: var(--card-radius);
padding: 0.5rem;
margin-bottom: 0.5rem;
box-shadow: var(--card-shadow);
border: none;
transition: var(--transition);
}
.form-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
}
.card-header {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
}
.card-title {
font-size: 1.3rem;
font-weight: 700;
color: #1e293b;
margin-bottom: 0.25rem;
}
/* 开关样式 */
.meal-toggle {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1.2rem;
border-radius: 16px;
background: var(--light-bg);
margin-bottom: 1rem;
cursor: pointer;
transition: var(--transition);
border: 2px solid transparent;
}
.meal-toggle:hover {
background: #f1f5f9;
}
.meal-toggle.active {
background: white;
border-color: var(--primary-color);
box-shadow: 0 5px 15px rgba(79, 70, 229, 0.1);
}
.toggle-label {
display: flex;
align-items: center;
font-size: 1.1rem;
font-weight: 600;
color: #1e293b;
}
/* 自定义单选按钮 */
.custom-radio {
display: none;
}
.custom-radio:checked + .meal-toggle {
background: white;
border-color: var(--primary-color);
box-shadow: 0 5px 15px rgba(79, 70, 229, 0.1);
}
/* 表单控件 */
.form-control-custom {
height: 56px;
border-radius: 12px;
border: 2px solid #e2e8f0;
font-size: 1.1rem;
padding: 0 1.2rem;
transition: var(--transition);
width: 100%;
}
.form-control-custom:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
textarea.form-control-custom {
height: auto;
padding: 1.2rem;
resize: vertical;
min-height: 120px;
}
/* 金额显示区域 */
.amount-display {
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
border-radius: 16px;
padding: 1.5rem;
margin-top: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.amount-label {
font-size: 1.1rem;
color: #475569;
font-weight: 600;
}
.amount-value {
font-size: 2rem;
font-weight: 800;
color: var(--success-color);
}
/* 提交按钮 */
.submit-btn {
height: 64px;
border-radius: 16px;
background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
border: none;
font-size: 1.3rem;
font-weight: 700;
color: white;
width: 100%;
margin-top: 1.5rem;
transition: var(--transition);
display: flex;
align-items: center;
justify-content: center;
gap: 0.8rem;
box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}
.submit-btn:hover {
transform: translateY(-3px);
box-shadow: 0 15px 30px rgba(79, 70, 229, 0.4);
}
.submit-btn:active {
transform: translateY(0);
}
.alert-success {
background-color: var(--success-color);
}
.alert-danger {
background-color: var(--warning-color);
}
/* 响应式调整 */
@media (max-width: 768px) {
.catering-container {
margin: 1rem auto;
padding: 0 0.75rem;
}
.page-header {
padding: 1.25rem;
}
.page-title {
font-size: 1.8rem;
}
.form-card {
padding: 0.5rem;
}
.card-header {
flex-direction: column;
align-items: flex-start;
}
}
</style>
<!-- 主容器 -->
<div class="catering-container">
<!-- 页面标题 -->
<div class="page-header">
<h1 class="page-title">
员工报餐登记
</h1>
</div>
<!-- 整个提交 form -->
<form id="cateringForm" action="/catering/create" method="post">
<!-- 当前员工ID -->
<input type="hidden" name="employee_id" t-att-value="employee.id"/>
<!-- 日期选择卡片 -->
<div class="form-card">
<div class="card-header">
<h3 class="card-title">选择用餐日期</h3>
</div>
<input type="date" name="date" required="1" class="form-control form-control-custom" t-att-value="date"/>
</div>
<!-- 早餐选择卡片 -->
<div class="form-card">
<div class="card-header">
<h3 class="card-title">早餐选择</h3>
</div>
<input type="radio" id="breakfast-true" name="breakfast" value="true" class="custom-radio" t-att-checked="'checked' if breakfast else None"/>
<label for="breakfast-true" class="meal-toggle">
<span class="toggle-label">
需要早餐
</span>
</label>
<input type="radio" id="breakfast-false" name="breakfast" value="false" class="custom-radio" t-att-checked="'checked' if not breakfast else None"/>
<label for="breakfast-false" class="meal-toggle">
<span class="toggle-label">
不需要早餐
</span>
</label>
</div>
<!-- 午餐选择卡片 -->
<div class="form-card">
<div class="card-header">
<h3 class="card-title">午餐选择</h3>
</div>
<input type="radio" id="lunch-true" name="lunch" value="true" class="custom-radio" t-att-checked="'checked' if lunch else None"/>
<label for="lunch-true" class="meal-toggle">
<span class="toggle-label">
需要午餐
</span>
</label>
<input type="radio" id="lunch-false" name="lunch" value="false" class="custom-radio" t-att-checked="'checked' if not lunch else None"/>
<label for="lunch-false" class="meal-toggle">
<span class="toggle-label">
不需要午餐
</span>
</label>
</div>
<!-- 金额输入卡片 -->
<div class="form-card">
<div class="card-header">
<h3 class="card-title">结算金额</h3>
</div>
<input type="number" step="0.01" min="0" name="amount" class="form-control form-control-custom" placeholder="如需手动调整金额,请在此输入"/>
</div>
<!-- 备注卡片 -->
<div class="form-card">
<div class="card-header">
<h3 class="card-title">备注信息</h3>
</div>
<textarea name="note" class="form-control form-control-custom" rows="3" placeholder="例如:素食、忌口食物、送餐时间要求等"/>
</div>
<div class="form-card alert alert-success" t-if="tips">
<t t-esc="tips"/>
</div>
<div class="form-card alert alert-danger" t-if="error">
<t t-esc="error"/>
</div>
<!-- 提交按钮 -->
<button type="submit" class="submit-btn">
<i class="fas fa-paper-plane"></i> 提交报餐登记
</button>
</form>
</div>
</template>
</odoo>