Edit UI SMS automation
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
import { computed, onMounted, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
|
import JalaliDateInput from '@/components/JalaliDateInput.vue';
|
||||||
|
import { formatLocalDateTimeInput, parseLocalInput } from '@/lib/jalali';
|
||||||
import type {
|
import type {
|
||||||
CreateMessageAutomationRuleRequest,
|
CreateMessageAutomationRuleRequest,
|
||||||
MessageAutomationChannel,
|
MessageAutomationChannel,
|
||||||
@@ -27,13 +29,10 @@ const items = ref<MessageAutomationRuleDto[]>([]);
|
|||||||
const editingId = ref<string | null>(null);
|
const editingId = ref<string | null>(null);
|
||||||
|
|
||||||
const name = ref('');
|
const name = ref('');
|
||||||
const isActive = ref(true);
|
|
||||||
const trigger = ref<MessageAutomationTrigger>('invoice_issued');
|
const trigger = ref<MessageAutomationTrigger>('invoice_issued');
|
||||||
const startDelayValue = ref(0);
|
const startAt = ref('');
|
||||||
const startDelayUnit = ref<MessageAutomationDelayUnit>('minutes');
|
|
||||||
const repeatCount = ref(1);
|
const repeatCount = ref(1);
|
||||||
const intervalValue = ref(2);
|
const intervalAt = ref('');
|
||||||
const intervalUnit = ref<MessageAutomationDelayUnit>('days');
|
|
||||||
const notifyTarget = ref<MessageAutomationTarget>('person');
|
const notifyTarget = ref<MessageAutomationTarget>('person');
|
||||||
const channel = ref<MessageAutomationChannel>('sms');
|
const channel = ref<MessageAutomationChannel>('sms');
|
||||||
const title = ref('');
|
const title = ref('');
|
||||||
@@ -45,16 +44,38 @@ const personNote = computed(
|
|||||||
'ناتیف داخل برنامه برای کارکنان است؛ برای مشتری پیامک ارسال میشود.',
|
'ناتیف داخل برنامه برای کارکنان است؛ برای مشتری پیامک ارسال میشود.',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function delayMs(value: number, unit: MessageAutomationDelayUnit) {
|
||||||
|
const n = Math.max(0, Math.trunc(Number(value) || 0));
|
||||||
|
if (unit === 'minutes') return n * 60_000;
|
||||||
|
if (unit === 'hours') return n * 3_600_000;
|
||||||
|
return n * 86_400_000;
|
||||||
|
}
|
||||||
|
|
||||||
|
function delayToIso(value: number, unit: MessageAutomationDelayUnit) {
|
||||||
|
if (!value) return '';
|
||||||
|
return formatLocalDateTimeInput(new Date(Date.now() + delayMs(value, unit)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function isoToDelay(iso: string): {
|
||||||
|
value: number;
|
||||||
|
unit: MessageAutomationDelayUnit;
|
||||||
|
} {
|
||||||
|
const date = parseLocalInput(iso);
|
||||||
|
if (!date) return { value: 0, unit: 'minutes' };
|
||||||
|
const mins = Math.max(0, Math.round((date.getTime() - Date.now()) / 60_000));
|
||||||
|
if (mins === 0) return { value: 0, unit: 'minutes' };
|
||||||
|
if (mins % (24 * 60) === 0) return { value: mins / (24 * 60), unit: 'days' };
|
||||||
|
if (mins % 60 === 0) return { value: mins / 60, unit: 'hours' };
|
||||||
|
return { value: mins, unit: 'minutes' };
|
||||||
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
editingId.value = null;
|
editingId.value = null;
|
||||||
name.value = '';
|
name.value = '';
|
||||||
isActive.value = true;
|
|
||||||
trigger.value = 'invoice_issued';
|
trigger.value = 'invoice_issued';
|
||||||
startDelayValue.value = 0;
|
startAt.value = '';
|
||||||
startDelayUnit.value = 'minutes';
|
|
||||||
repeatCount.value = 1;
|
repeatCount.value = 1;
|
||||||
intervalValue.value = 2;
|
intervalAt.value = delayToIso(2, 'days');
|
||||||
intervalUnit.value = 'days';
|
|
||||||
notifyTarget.value = 'person';
|
notifyTarget.value = 'person';
|
||||||
channel.value = 'sms';
|
channel.value = 'sms';
|
||||||
title.value = '';
|
title.value = '';
|
||||||
@@ -65,13 +86,10 @@ function resetForm() {
|
|||||||
function startEdit(row: MessageAutomationRuleDto) {
|
function startEdit(row: MessageAutomationRuleDto) {
|
||||||
editingId.value = row.id;
|
editingId.value = row.id;
|
||||||
name.value = row.name;
|
name.value = row.name;
|
||||||
isActive.value = row.isActive;
|
|
||||||
trigger.value = row.trigger;
|
trigger.value = row.trigger;
|
||||||
startDelayValue.value = row.startDelayValue;
|
startAt.value = delayToIso(row.startDelayValue, row.startDelayUnit);
|
||||||
startDelayUnit.value = row.startDelayUnit;
|
|
||||||
repeatCount.value = row.repeatCount;
|
repeatCount.value = row.repeatCount;
|
||||||
intervalValue.value = row.intervalValue;
|
intervalAt.value = delayToIso(row.intervalValue, row.intervalUnit);
|
||||||
intervalUnit.value = row.intervalUnit;
|
|
||||||
notifyTarget.value = row.notifyTarget;
|
notifyTarget.value = row.notifyTarget;
|
||||||
channel.value = row.channel;
|
channel.value = row.channel;
|
||||||
title.value = row.title;
|
title.value = row.title;
|
||||||
@@ -104,15 +122,17 @@ async function load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function payload(): CreateMessageAutomationRuleRequest {
|
function payload(): CreateMessageAutomationRuleRequest {
|
||||||
|
const start = isoToDelay(startAt.value);
|
||||||
|
const interval = isoToDelay(intervalAt.value);
|
||||||
return {
|
return {
|
||||||
name: name.value.trim(),
|
name: name.value.trim(),
|
||||||
isActive: isActive.value,
|
isActive: true,
|
||||||
trigger: trigger.value,
|
trigger: trigger.value,
|
||||||
startDelayValue: startDelayValue.value,
|
startDelayValue: start.value,
|
||||||
startDelayUnit: startDelayUnit.value,
|
startDelayUnit: start.unit,
|
||||||
repeatCount: repeatCount.value,
|
repeatCount: repeatCount.value,
|
||||||
intervalValue: intervalValue.value,
|
intervalValue: Math.max(1, interval.value || 1),
|
||||||
intervalUnit: intervalUnit.value,
|
intervalUnit: interval.value ? interval.unit : 'days',
|
||||||
notifyTarget: notifyTarget.value,
|
notifyTarget: notifyTarget.value,
|
||||||
channel: channel.value,
|
channel: channel.value,
|
||||||
title: title.value.trim(),
|
title: title.value.trim(),
|
||||||
@@ -130,7 +150,8 @@ async function save() {
|
|||||||
ok.value = '';
|
ok.value = '';
|
||||||
try {
|
try {
|
||||||
if (editingId.value) {
|
if (editingId.value) {
|
||||||
const bodyDto: UpdateMessageAutomationRuleRequest = payload();
|
const { isActive: _ignore, ...rest } = payload();
|
||||||
|
const bodyDto: UpdateMessageAutomationRuleRequest = rest;
|
||||||
await api.patch(`/message-automations/${editingId.value}`, bodyDto);
|
await api.patch(`/message-automations/${editingId.value}`, bodyDto);
|
||||||
ok.value = 'قانون بهروز شد.';
|
ok.value = 'قانون بهروز شد.';
|
||||||
} else {
|
} else {
|
||||||
@@ -178,6 +199,11 @@ onMounted(load);
|
|||||||
جدا از اتوماسیون گردش کار. فقط برای پیامک و ناتیف: چه اتفاقی بیفتد، چند بار و با چه فاصلهای.
|
جدا از اتوماسیون گردش کار. فقط برای پیامک و ناتیف: چه اتفاقی بیفتد، چند بار و با چه فاصلهای.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="head-actions">
|
||||||
|
<button class="btn ghost" type="button" :disabled="loading" @click="load">
|
||||||
|
بروزرسانی
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<p v-if="error" class="error">{{ error }}</p>
|
<p v-if="error" class="error">{{ error }}</p>
|
||||||
@@ -185,59 +211,44 @@ onMounted(load);
|
|||||||
|
|
||||||
<form class="panel" @submit.prevent="save">
|
<form class="panel" @submit.prevent="save">
|
||||||
<h2>{{ editingId ? 'ویرایش قانون' : 'قانون جدید' }}</h2>
|
<h2>{{ editingId ? 'ویرایش قانون' : 'قانون جدید' }}</h2>
|
||||||
<label class="field">
|
<div class="form-grid">
|
||||||
عنوان قانون
|
<label class="field span-6">
|
||||||
<input v-model="name" maxlength="120" placeholder="مثلاً تشکر بعد از فاکتور" />
|
عنوان قانون
|
||||||
</label>
|
<input v-model="name" maxlength="120" placeholder="مثلاً تشکر بعد از فاکتور" />
|
||||||
<label class="field">
|
|
||||||
چه زمانی شروع شود
|
|
||||||
<select v-model="trigger">
|
|
||||||
<option
|
|
||||||
v-for="item in MESSAGE_AUTOMATION_TRIGGERS"
|
|
||||||
:key="item"
|
|
||||||
:value="item"
|
|
||||||
>
|
|
||||||
{{ MESSAGE_AUTOMATION_TRIGGER_LABELS[item] }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div class="row-fields">
|
|
||||||
<label class="field">
|
|
||||||
شروع ارسال
|
|
||||||
<input v-model.number="startDelayValue" type="number" min="0" max="365" />
|
|
||||||
</label>
|
</label>
|
||||||
<label class="field">
|
<label class="field span-6">
|
||||||
واحد شروع
|
چه زمانی شروع شود
|
||||||
<select v-model="startDelayUnit">
|
<select v-model="trigger">
|
||||||
<option value="minutes">دقیقه بعد</option>
|
<option
|
||||||
<option value="hours">ساعت بعد</option>
|
v-for="item in MESSAGE_AUTOMATION_TRIGGERS"
|
||||||
<option value="days">روز بعد</option>
|
:key="item"
|
||||||
|
:value="item"
|
||||||
|
>
|
||||||
|
{{ MESSAGE_AUTOMATION_TRIGGER_LABELS[item] }}
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="field">
|
<div class="field span-5">
|
||||||
تعداد ارسال
|
<span>شروع ارسال</span>
|
||||||
|
<JalaliDateInput
|
||||||
|
v-model="startAt"
|
||||||
|
mode="datetime"
|
||||||
|
placeholder="همان لحظه"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<label class="field span-2">
|
||||||
|
تعداد
|
||||||
<input v-model.number="repeatCount" type="number" min="1" max="10" />
|
<input v-model.number="repeatCount" type="number" min="1" max="10" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
<div v-if="repeatCount > 1" class="field span-5">
|
||||||
<div v-if="repeatCount > 1" class="row-fields">
|
<span>فاصله بین پیامها</span>
|
||||||
<label class="field">
|
<JalaliDateInput
|
||||||
فاصله بین پیامها
|
v-model="intervalAt"
|
||||||
<input v-model.number="intervalValue" type="number" min="1" max="365" />
|
mode="datetime"
|
||||||
</label>
|
placeholder="انتخاب روز و ساعت"
|
||||||
<label class="field">
|
/>
|
||||||
واحد فاصله
|
</div>
|
||||||
<select v-model="intervalUnit">
|
<label class="field span-4">
|
||||||
<option value="minutes">دقیقه</option>
|
|
||||||
<option value="hours">ساعت</option>
|
|
||||||
<option value="days">روز</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<p class="hint">
|
|
||||||
صفر یعنی همان لحظه. برای چندباره: مثلاً ۳ بار، هر ۲ روز.
|
|
||||||
</p>
|
|
||||||
<div class="row-fields">
|
|
||||||
<label class="field">
|
|
||||||
برای چه کسی
|
برای چه کسی
|
||||||
<select v-model="notifyTarget">
|
<select v-model="notifyTarget">
|
||||||
<option value="person">مشتری</option>
|
<option value="person">مشتری</option>
|
||||||
@@ -245,7 +256,7 @@ onMounted(load);
|
|||||||
<option value="both">مشتری و مسئول</option>
|
<option value="both">مشتری و مسئول</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="field">
|
<label class="field span-4">
|
||||||
از چه راهی
|
از چه راهی
|
||||||
<select v-model="channel">
|
<select v-model="channel">
|
||||||
<option value="sms">پیامک</option>
|
<option value="sms">پیامک</option>
|
||||||
@@ -253,27 +264,23 @@ onMounted(load);
|
|||||||
<option value="both">پیامک و ناتیف</option>
|
<option value="both">پیامک و ناتیف</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="field span-4">
|
||||||
|
عنوان پیام
|
||||||
|
<input v-model="title" maxlength="120" placeholder="عنوان ناتیف یا ابتدای پیامک" />
|
||||||
|
</label>
|
||||||
|
<label class="field span-12">
|
||||||
|
متن پیام
|
||||||
|
<textarea
|
||||||
|
v-model="body"
|
||||||
|
maxlength="500"
|
||||||
|
placeholder="میتوانید {title} را برای نام همان رکورد بگذارید"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="personNote" class="hint">{{ personNote }}</p>
|
<p v-if="personNote" class="hint">{{ personNote }}</p>
|
||||||
<label class="field">
|
|
||||||
عنوان پیام
|
|
||||||
<input v-model="title" maxlength="120" placeholder="عنوان ناتیف یا ابتدای پیامک" />
|
|
||||||
</label>
|
|
||||||
<label class="field">
|
|
||||||
متن پیام
|
|
||||||
<textarea
|
|
||||||
v-model="body"
|
|
||||||
maxlength="500"
|
|
||||||
placeholder="میتوانید {title} را برای نام همان رکورد بگذارید"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<label class="check">
|
|
||||||
<input v-model="isActive" type="checkbox" />
|
|
||||||
قانون فعال باشد
|
|
||||||
</label>
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button class="btn primary" type="submit" :disabled="saving">
|
<button class="btn primary" type="submit" :disabled="saving">
|
||||||
{{ saving ? '…' : editingId ? 'ذخیره تغییرات' : 'ساخت قانون' }}
|
{{ saving ? 'در حال ذخیره…' : editingId ? 'ذخیره' : 'ساخت' }}
|
||||||
</button>
|
</button>
|
||||||
<button v-if="editingId" class="btn ghost" type="button" @click="resetForm">
|
<button v-if="editingId" class="btn ghost" type="button" @click="resetForm">
|
||||||
انصراف
|
انصراف
|
||||||
@@ -281,35 +288,81 @@ onMounted(load);
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="list">
|
<div class="list-wrap">
|
||||||
<article v-for="row in items" :key="row.id" class="card" :class="{ off: !row.isActive }">
|
<table v-if="items.length" class="desk-table">
|
||||||
<header>
|
<thead>
|
||||||
<strong>{{ row.name }}</strong>
|
<tr>
|
||||||
<button
|
<th>عنوان</th>
|
||||||
class="switch"
|
<th>رویداد</th>
|
||||||
type="button"
|
<th>زمانبندی</th>
|
||||||
:aria-pressed="row.isActive"
|
<th>مخاطب</th>
|
||||||
@click="toggle(row)"
|
<th>کانال</th>
|
||||||
>
|
<th>فعال</th>
|
||||||
{{ row.isActive ? 'فعال' : 'خاموش' }}
|
<th></th>
|
||||||
</button>
|
</tr>
|
||||||
</header>
|
</thead>
|
||||||
<p>
|
<tbody>
|
||||||
{{ MESSAGE_AUTOMATION_TRIGGER_LABELS[row.trigger] }}
|
<tr v-for="row in items" :key="row.id" :class="{ off: !row.isActive }">
|
||||||
·
|
<td>
|
||||||
{{ scheduleLabel(row) }}
|
<strong>{{ row.name }}</strong>
|
||||||
</p>
|
<span class="preview">{{ row.body }}</span>
|
||||||
<p class="muted">
|
</td>
|
||||||
{{ MESSAGE_AUTOMATION_TARGET_LABELS[row.notifyTarget] }}
|
<td>{{ MESSAGE_AUTOMATION_TRIGGER_LABELS[row.trigger] }}</td>
|
||||||
·
|
<td>{{ scheduleLabel(row) }}</td>
|
||||||
{{ MESSAGE_AUTOMATION_CHANNEL_LABELS[row.channel] }}
|
<td>{{ MESSAGE_AUTOMATION_TARGET_LABELS[row.notifyTarget] }}</td>
|
||||||
</p>
|
<td>{{ MESSAGE_AUTOMATION_CHANNEL_LABELS[row.channel] }}</td>
|
||||||
<p class="preview">{{ row.body }}</p>
|
<td>
|
||||||
<div class="card-actions">
|
<button
|
||||||
<button class="btn ghost" type="button" @click="startEdit(row)">ویرایش</button>
|
class="toggle"
|
||||||
<button class="btn danger" type="button" @click="remove(row)">حذف</button>
|
type="button"
|
||||||
</div>
|
:class="{ on: row.isActive }"
|
||||||
</article>
|
:aria-pressed="row.isActive"
|
||||||
|
:aria-label="row.isActive ? 'فعال' : 'غیرفعال'"
|
||||||
|
@click="toggle(row)"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td class="ops">
|
||||||
|
<button class="btn ghost" type="button" @click="startEdit(row)">ویرایش</button>
|
||||||
|
<button class="btn danger" type="button" @click="remove(row)">حذف</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="mobile-cards">
|
||||||
|
<article
|
||||||
|
v-for="row in items"
|
||||||
|
:key="row.id"
|
||||||
|
class="card"
|
||||||
|
:class="{ off: !row.isActive }"
|
||||||
|
>
|
||||||
|
<header>
|
||||||
|
<div>
|
||||||
|
<strong>{{ row.name }}</strong>
|
||||||
|
<p class="muted">{{ MESSAGE_AUTOMATION_TRIGGER_LABELS[row.trigger] }}</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="toggle"
|
||||||
|
type="button"
|
||||||
|
:class="{ on: row.isActive }"
|
||||||
|
:aria-pressed="row.isActive"
|
||||||
|
:aria-label="row.isActive ? 'فعال' : 'غیرفعال'"
|
||||||
|
@click="toggle(row)"
|
||||||
|
/>
|
||||||
|
</header>
|
||||||
|
<p>{{ scheduleLabel(row) }}</p>
|
||||||
|
<p class="muted">
|
||||||
|
{{ MESSAGE_AUTOMATION_TARGET_LABELS[row.notifyTarget] }}
|
||||||
|
·
|
||||||
|
{{ MESSAGE_AUTOMATION_CHANNEL_LABELS[row.channel] }}
|
||||||
|
</p>
|
||||||
|
<p class="preview">{{ row.body }}</p>
|
||||||
|
<div class="card-actions">
|
||||||
|
<button class="btn ghost" type="button" @click="startEdit(row)">ویرایش</button>
|
||||||
|
<button class="btn danger" type="button" @click="remove(row)">حذف</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
<p v-if="!loading && !items.length" class="empty">هنوز قانون پیامی نیست.</p>
|
<p v-if="!loading && !items.length" class="empty">هنوز قانون پیامی نیست.</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -319,14 +372,26 @@ onMounted(load);
|
|||||||
.page {
|
.page {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
max-width: 760px;
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head {
|
.page-head {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head-copy {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.55rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@@ -336,15 +401,14 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0 0 0.15rem;
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lead,
|
.lead,
|
||||||
.muted,
|
.muted,
|
||||||
.hint,
|
.hint {
|
||||||
.empty {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
@@ -353,36 +417,49 @@ h2 {
|
|||||||
font-size: 0.82rem;
|
font-size: 0.82rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel,
|
.empty {
|
||||||
.list {
|
margin: 0;
|
||||||
display: grid;
|
padding: 1.4rem 0.2rem;
|
||||||
gap: 0.75rem;
|
text-align: center;
|
||||||
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel {
|
.panel,
|
||||||
|
.list-wrap {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #e2e8f0;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 18px;
|
border-radius: 18px;
|
||||||
box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
|
box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
|
||||||
padding: 1.1rem;
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-wrap {
|
||||||
|
padding: 0.85rem 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 1rem 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 0.7rem 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field {
|
.field {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.35rem;
|
gap: 0.3rem;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
font-size: 0.9rem;
|
font-size: 0.86rem;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row-fields {
|
.field :deep(.wrap),
|
||||||
display: flex;
|
.field :deep(.trigger) {
|
||||||
flex-wrap: wrap;
|
width: 100%;
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row-fields .field {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 8rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
@@ -400,19 +477,13 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
min-height: 5.5rem;
|
min-height: 4.2rem;
|
||||||
padding: 0.65rem 0.85rem;
|
padding: 0.55rem 0.85rem;
|
||||||
}
|
|
||||||
|
|
||||||
.check {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.4rem;
|
|
||||||
color: #334155;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-actions,
|
.form-actions,
|
||||||
.card-actions {
|
.card-actions,
|
||||||
|
.ops {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -422,6 +493,7 @@ textarea {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
gap: 0.35rem;
|
||||||
min-height: var(--control-h);
|
min-height: var(--control-h);
|
||||||
padding: 0 0.95rem;
|
padding: 0 0.95rem;
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
@@ -434,6 +506,7 @@ textarea {
|
|||||||
.btn.primary {
|
.btn.primary {
|
||||||
background: #14b8a6;
|
background: #14b8a6;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
box-shadow: 0 8px 18px rgba(20, 184, 166, 0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.ghost {
|
.btn.ghost {
|
||||||
@@ -448,13 +521,63 @@ textarea {
|
|||||||
border-color: #fecaca;
|
border-color: #fecaca;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.desk-table {
|
||||||
background: #fff;
|
display: none;
|
||||||
border: 1px solid #e2e8f0;
|
width: 100%;
|
||||||
border-radius: 18px;
|
border-collapse: collapse;
|
||||||
padding: 1rem;
|
}
|
||||||
|
|
||||||
|
.desk-table th,
|
||||||
|
.desk-table td {
|
||||||
|
padding: 0.85rem 0.9rem;
|
||||||
|
text-align: start;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desk-table th {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desk-table td {
|
||||||
|
font-size: 0.88rem;
|
||||||
|
color: #334155;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desk-table td strong {
|
||||||
|
display: block;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desk-table tr.off {
|
||||||
|
opacity: 0.62;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desk-table .preview {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
max-width: 18rem;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-cards {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.35rem;
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.4rem;
|
||||||
|
padding: 0.95rem 1rem;
|
||||||
|
border: 1px solid #eef2f7;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #f8fafc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.off {
|
.card.off {
|
||||||
@@ -463,7 +586,7 @@ textarea {
|
|||||||
|
|
||||||
.card header {
|
.card header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
}
|
}
|
||||||
@@ -472,26 +595,42 @@ textarea {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview {
|
.card .preview {
|
||||||
color: #334155;
|
color: #334155;
|
||||||
font-size: 0.88rem;
|
font-size: 0.88rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.switch {
|
.toggle {
|
||||||
|
position: relative;
|
||||||
|
width: 42px;
|
||||||
|
height: 24px;
|
||||||
border: 0;
|
border: 0;
|
||||||
background: #ecfdf8;
|
|
||||||
color: #0f766e;
|
|
||||||
font: inherit;
|
|
||||||
font-weight: 800;
|
|
||||||
font-size: 0.78rem;
|
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
padding: 0.3rem 0.7rem;
|
background: #cbd5e1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.off .switch {
|
.toggle::after {
|
||||||
background: #f1f5f9;
|
content: '';
|
||||||
color: #64748b;
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
left: 2px;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.16);
|
||||||
|
transition: left 0.16s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle.on {
|
||||||
|
background: #14b8a6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle.on::after {
|
||||||
|
left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
@@ -504,4 +643,24 @@ textarea {
|
|||||||
color: #0f766e;
|
color: #0f766e;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 900px) {
|
||||||
|
.form-grid {
|
||||||
|
grid-template-columns: repeat(12, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.span-2 { grid-column: span 2; }
|
||||||
|
.span-4 { grid-column: span 4; }
|
||||||
|
.span-5 { grid-column: span 5; }
|
||||||
|
.span-6 { grid-column: span 6; }
|
||||||
|
.span-12 { grid-column: span 12; }
|
||||||
|
|
||||||
|
.desk-table {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-cards {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user