Remove tiktok_shop and shopee_shop URL and ID fields from MarketplaceRequest, MarketplaceService, MarketplaceSettings, and related database migration. Update MarketplaceSection and other components to reflect these changes, ensuring a cleaner and more focused marketplace settings structure.
This commit is contained in:
parent
93992a0d3a
commit
1e32837d76
@ -22,8 +22,6 @@ public function rules(): array
|
||||
'tiktok_shop_affiliate_commission' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'tiktok_shop_shipping_subsidy' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'tiktok_shop_vat_rate' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'tiktok_shop_url' => ['nullable', 'url', 'max:500'],
|
||||
'tiktok_shop_id' => ['nullable', 'string', 'max:100'],
|
||||
|
||||
'shopee_enabled' => ['required', 'boolean'],
|
||||
'shopee_commission_fee' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
@ -33,8 +31,6 @@ public function rules(): array
|
||||
'shopee_affiliate_commission' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'shopee_shipping_subsidy' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'shopee_voucher_fee' => ['required', 'numeric', 'min:0', 'max:100'],
|
||||
'shopee_shop_url' => ['nullable', 'url', 'max:500'],
|
||||
'shopee_shop_id' => ['nullable', 'string', 'max:100'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,8 +18,6 @@ public function marketplaceData(): array
|
||||
'tiktok_shop_affiliate_commission' => $settings->tiktok_shop_affiliate_commission,
|
||||
'tiktok_shop_shipping_subsidy' => $settings->tiktok_shop_shipping_subsidy,
|
||||
'tiktok_shop_vat_rate' => $settings->tiktok_shop_vat_rate,
|
||||
'tiktok_shop_url' => $settings->tiktok_shop_url,
|
||||
'tiktok_shop_id' => $settings->tiktok_shop_id,
|
||||
'shopee_enabled' => $settings->shopee_enabled,
|
||||
'shopee_commission_fee' => $settings->shopee_commission_fee,
|
||||
'shopee_transaction_fee' => $settings->shopee_transaction_fee,
|
||||
@ -28,8 +26,6 @@ public function marketplaceData(): array
|
||||
'shopee_affiliate_commission' => $settings->shopee_affiliate_commission,
|
||||
'shopee_shipping_subsidy' => $settings->shopee_shipping_subsidy,
|
||||
'shopee_voucher_fee' => $settings->shopee_voucher_fee,
|
||||
'shopee_shop_url' => $settings->shopee_shop_url,
|
||||
'shopee_shop_id' => $settings->shopee_shop_id,
|
||||
];
|
||||
}
|
||||
|
||||
@ -44,8 +40,6 @@ public function updateMarketplace(array $validated): void
|
||||
$settings->tiktok_shop_affiliate_commission = $validated['tiktok_shop_affiliate_commission'];
|
||||
$settings->tiktok_shop_shipping_subsidy = $validated['tiktok_shop_shipping_subsidy'];
|
||||
$settings->tiktok_shop_vat_rate = $validated['tiktok_shop_vat_rate'];
|
||||
$settings->tiktok_shop_url = $validated['tiktok_shop_url'] ?? null;
|
||||
$settings->tiktok_shop_id = $validated['tiktok_shop_id'] ?? null;
|
||||
|
||||
$settings->shopee_enabled = $validated['shopee_enabled'];
|
||||
$settings->shopee_commission_fee = $validated['shopee_commission_fee'];
|
||||
@ -55,8 +49,6 @@ public function updateMarketplace(array $validated): void
|
||||
$settings->shopee_affiliate_commission = $validated['shopee_affiliate_commission'];
|
||||
$settings->shopee_shipping_subsidy = $validated['shopee_shipping_subsidy'];
|
||||
$settings->shopee_voucher_fee = $validated['shopee_voucher_fee'];
|
||||
$settings->shopee_shop_url = $validated['shopee_shop_url'] ?? null;
|
||||
$settings->shopee_shop_id = $validated['shopee_shop_id'] ?? null;
|
||||
|
||||
$settings->save();
|
||||
}
|
||||
|
||||
@ -20,10 +20,6 @@ class MarketplaceSettings extends Settings
|
||||
|
||||
public float $tiktok_shop_vat_rate;
|
||||
|
||||
public ?string $tiktok_shop_url;
|
||||
|
||||
public ?string $tiktok_shop_id;
|
||||
|
||||
public bool $shopee_enabled;
|
||||
|
||||
public float $shopee_commission_fee;
|
||||
@ -40,10 +36,6 @@ class MarketplaceSettings extends Settings
|
||||
|
||||
public float $shopee_voucher_fee;
|
||||
|
||||
public ?string $shopee_shop_url;
|
||||
|
||||
public ?string $shopee_shop_id;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'marketplace';
|
||||
|
||||
@ -31,8 +31,6 @@ public function up(): void
|
||||
$blueprint->add('tiktok_shop_affiliate_commission', 0.0);
|
||||
$blueprint->add('tiktok_shop_shipping_subsidy', 0.0);
|
||||
$blueprint->add('tiktok_shop_vat_rate', 11.0);
|
||||
$blueprint->add('tiktok_shop_url', null);
|
||||
$blueprint->add('tiktok_shop_id', null);
|
||||
|
||||
$blueprint->add('shopee_enabled', true);
|
||||
$blueprint->add('shopee_commission_fee', 6.0);
|
||||
@ -42,8 +40,6 @@ public function up(): void
|
||||
$blueprint->add('shopee_affiliate_commission', 0.0);
|
||||
$blueprint->add('shopee_shipping_subsidy', 0.0);
|
||||
$blueprint->add('shopee_voucher_fee', 0.0);
|
||||
$blueprint->add('shopee_shop_url', null);
|
||||
$blueprint->add('shopee_shop_id', null);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -4,12 +4,24 @@ import { Save, ShoppingBag, Store } from '@lucide/vue';
|
||||
import { ref } from 'vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldSet } from '@/components/ui/field';
|
||||
import {
|
||||
Card,
|
||||
CardContent
|
||||
} from '@/components/ui/card';
|
||||
import {
|
||||
Field, FieldError,
|
||||
FieldGroup,
|
||||
FieldLabel,
|
||||
FieldSet
|
||||
} from '@/components/ui/field';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { formErrors } from '@/lib/form';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { MarketplacePlatform, MarketplaceSettingsData } from '@/types/setting';
|
||||
import type {
|
||||
MarketplacePlatform,
|
||||
MarketplaceSettingsData,
|
||||
} from '@/types/setting';
|
||||
|
||||
const props = defineProps<{
|
||||
data: MarketplaceSettingsData;
|
||||
@ -34,8 +46,6 @@ const form = useForm({
|
||||
tiktok_shop_affiliate_commission: props.data.tiktok_shop_affiliate_commission,
|
||||
tiktok_shop_shipping_subsidy: props.data.tiktok_shop_shipping_subsidy,
|
||||
tiktok_shop_vat_rate: props.data.tiktok_shop_vat_rate,
|
||||
tiktok_shop_url: props.data.tiktok_shop_url ?? '',
|
||||
tiktok_shop_id: props.data.tiktok_shop_id ?? '',
|
||||
|
||||
shopee_enabled: props.data.shopee_enabled,
|
||||
shopee_commission_fee: props.data.shopee_commission_fee,
|
||||
@ -45,8 +55,6 @@ const form = useForm({
|
||||
shopee_affiliate_commission: props.data.shopee_affiliate_commission,
|
||||
shopee_shipping_subsidy: props.data.shopee_shipping_subsidy,
|
||||
shopee_voucher_fee: props.data.shopee_voucher_fee,
|
||||
shopee_shop_url: props.data.shopee_shop_url ?? '',
|
||||
shopee_shop_id: props.data.shopee_shop_id ?? '',
|
||||
});
|
||||
|
||||
function submit() {
|
||||
@ -76,22 +84,6 @@ function submit() {
|
||||
|
||||
<div class="min-w-0 flex-1 space-y-6">
|
||||
<Card v-show="activePlatform === 'tiktok_shop'">
|
||||
<CardHeader>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<CardTitle>TikTok Shop</CardTitle>
|
||||
<CardDescription>
|
||||
Biaya dan konfigurasi penjualan di TikTok Shop.
|
||||
</CardDescription>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<Switch id="tiktok_shop_enabled" v-model:checked="form.tiktok_shop_enabled" />
|
||||
<FieldLabel for="tiktok_shop_enabled" class="mb-0 text-sm">
|
||||
Aktif
|
||||
</FieldLabel>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FieldSet>
|
||||
<FieldGroup class="grid gap-4 sm:grid-cols-2">
|
||||
@ -99,25 +91,21 @@ function submit() {
|
||||
<FieldLabel for="tiktok_shop_admin_fee">Biaya Admin (%)</FieldLabel>
|
||||
<Input id="tiktok_shop_admin_fee" v-model="form.tiktok_shop_admin_fee" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldDescription>Komisi platform TikTok Shop.</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_admin_fee ? [form.errors.tiktok_shop_admin_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_admin_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_transaction_fee">Biaya Transaksi (%)</FieldLabel>
|
||||
<Input id="tiktok_shop_transaction_fee" v-model="form.tiktok_shop_transaction_fee"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_transaction_fee ? [form.errors.tiktok_shop_transaction_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_transaction_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_payment_fee">Biaya Pembayaran (%)</FieldLabel>
|
||||
<Input id="tiktok_shop_payment_fee" v-model="form.tiktok_shop_payment_fee"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_payment_fee ? [form.errors.tiktok_shop_payment_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_payment_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
@ -125,64 +113,35 @@ function submit() {
|
||||
<Input id="tiktok_shop_affiliate_commission"
|
||||
v-model="form.tiktok_shop_affiliate_commission" type="number" step="0.01"
|
||||
min="0" max="100" />
|
||||
<FieldDescription>Biaya jika penjualan via afiliasi/kreator.</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_affiliate_commission ? [form.errors.tiktok_shop_affiliate_commission] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_affiliate_commission')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_shipping_subsidy">Subsidi Ongkir (%)</FieldLabel>
|
||||
<Input id="tiktok_shop_shipping_subsidy" v-model="form.tiktok_shop_shipping_subsidy"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_shipping_subsidy ? [form.errors.tiktok_shop_shipping_subsidy] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_shipping_subsidy')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_vat_rate">PPN / Pajak (%)</FieldLabel>
|
||||
<Input id="tiktok_shop_vat_rate" v-model="form.tiktok_shop_vat_rate" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_vat_rate ? [form.errors.tiktok_shop_vat_rate] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_shop_vat_rate')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_url">URL Toko</FieldLabel>
|
||||
<Input id="tiktok_shop_url" v-model="form.tiktok_shop_url" type="url"
|
||||
placeholder="https://www.tiktok.com/@toko" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_url ? [form.errors.tiktok_shop_url] : []" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="tiktok_shop_id">Shop ID</FieldLabel>
|
||||
<Input id="tiktok_shop_id" v-model="form.tiktok_shop_id"
|
||||
placeholder="ID toko TikTok Shop" />
|
||||
<FieldError
|
||||
:errors="form.errors.tiktok_shop_id ? [form.errors.tiktok_shop_id] : []" />
|
||||
</Field>
|
||||
<div class="flex items-center gap-2">
|
||||
<Switch id="tiktok_shop_enabled" v-model:checked="form.tiktok_shop_enabled" />
|
||||
<FieldLabel for="tiktok_shop_enabled" class="mb-0 text-sm">
|
||||
Aktif
|
||||
</FieldLabel>
|
||||
</div>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card v-show="activePlatform === 'shopee'">
|
||||
<CardHeader>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<CardTitle>Shopee</CardTitle>
|
||||
<CardDescription>
|
||||
Biaya dan konfigurasi penjualan di Shopee.
|
||||
</CardDescription>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<Switch id="shopee_enabled" v-model:checked="form.shopee_enabled" />
|
||||
<FieldLabel for="shopee_enabled" class="mb-0 text-sm">
|
||||
Aktif
|
||||
</FieldLabel>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FieldSet>
|
||||
<FieldGroup class="grid gap-4 sm:grid-cols-2">
|
||||
@ -190,34 +149,28 @@ function submit() {
|
||||
<FieldLabel for="shopee_commission_fee">Komisi Shopee (%)</FieldLabel>
|
||||
<Input id="shopee_commission_fee" v-model="form.shopee_commission_fee" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldDescription>Komisi penjualan kategori umum.</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_commission_fee ? [form.errors.shopee_commission_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_commission_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_transaction_fee">Biaya Transaksi (%)</FieldLabel>
|
||||
<Input id="shopee_transaction_fee" v-model="form.shopee_transaction_fee"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_transaction_fee ? [form.errors.shopee_transaction_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_transaction_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_service_fee">Biaya Layanan (%)</FieldLabel>
|
||||
<Input id="shopee_service_fee" v-model="form.shopee_service_fee" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldDescription>Biaya program Shopee (jika berlaku).</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_service_fee ? [form.errors.shopee_service_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_service_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_payment_fee">Biaya Pembayaran (%)</FieldLabel>
|
||||
<Input id="shopee_payment_fee" v-model="form.shopee_payment_fee" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_payment_fee ? [form.errors.shopee_payment_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_payment_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
@ -225,43 +178,29 @@ function submit() {
|
||||
</FieldLabel>
|
||||
<Input id="shopee_affiliate_commission" v-model="form.shopee_affiliate_commission"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldDescription>Shopee Affiliate / kolaborasi kreator.</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_affiliate_commission ? [form.errors.shopee_affiliate_commission] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_affiliate_commission')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_shipping_subsidy">Subsidi Ongkir (%)</FieldLabel>
|
||||
<Input id="shopee_shipping_subsidy" v-model="form.shopee_shipping_subsidy"
|
||||
type="number" step="0.01" min="0" max="100" />
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_shipping_subsidy ? [form.errors.shopee_shipping_subsidy] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_shipping_subsidy')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_voucher_fee">Biaya Voucher / Diskon (%)</FieldLabel>
|
||||
<Input id="shopee_voucher_fee" v-model="form.shopee_voucher_fee" type="number"
|
||||
step="0.01" min="0" max="100" />
|
||||
<FieldDescription>Estimasi biaya voucher toko atau campaign.</FieldDescription>
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_voucher_fee ? [form.errors.shopee_voucher_fee] : []" />
|
||||
<FieldError :errors="formErrors(form, 'shopee_voucher_fee')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_shop_url">URL Toko</FieldLabel>
|
||||
<Input id="shopee_shop_url" v-model="form.shopee_shop_url" type="url"
|
||||
placeholder="https://shopee.co.id/namatoko" />
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_shop_url ? [form.errors.shopee_shop_url] : []" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="shopee_shop_id">Shop ID</FieldLabel>
|
||||
<Input id="shopee_shop_id" v-model="form.shopee_shop_id"
|
||||
placeholder="ID toko Shopee" />
|
||||
<FieldError
|
||||
:errors="form.errors.shopee_shop_id ? [form.errors.shopee_shop_id] : []" />
|
||||
</Field>
|
||||
<div class="flex items-center gap-2">
|
||||
<Switch id="shopee_enabled" v-model:checked="form.shopee_enabled" />
|
||||
<FieldLabel for="shopee_enabled" class="mb-0 text-sm">
|
||||
Aktif
|
||||
</FieldLabel>
|
||||
</div>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
</CardContent>
|
||||
|
||||
@ -3,9 +3,10 @@ import { useForm } from '@inertiajs/vue3';
|
||||
import { Save } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Field, FieldError, FieldGroup, FieldLabel, FieldSet } from '@/components/ui/field';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { formErrors } from '@/lib/form';
|
||||
import type { SocialMediaSettingsData } from '@/types/setting';
|
||||
|
||||
const props = defineProps<{
|
||||
@ -31,12 +32,6 @@ function submit() {
|
||||
<template>
|
||||
<form @submit.prevent="submit">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Media Sosial</CardTitle>
|
||||
<CardDescription>
|
||||
Tautan profil media sosial yang ditampilkan di website atau aplikasi.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FieldSet>
|
||||
<FieldGroup class="grid gap-4">
|
||||
@ -46,7 +41,7 @@ function submit() {
|
||||
</FieldLabel>
|
||||
<Input id="instagram_url" v-model="form.instagram_url" type="url"
|
||||
placeholder="https://instagram.com/username" />
|
||||
<FieldError :errors="form.errors.instagram_url ? [form.errors.instagram_url] : []" />
|
||||
<FieldError :errors="formErrors(form, 'instagram_url')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
@ -55,7 +50,7 @@ function submit() {
|
||||
</FieldLabel>
|
||||
<Input id="facebook_url" v-model="form.facebook_url" type="url"
|
||||
placeholder="https://facebook.com/pagename" />
|
||||
<FieldError :errors="form.errors.facebook_url ? [form.errors.facebook_url] : []" />
|
||||
<FieldError :errors="formErrors(form, 'facebook_url')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
@ -64,7 +59,7 @@ function submit() {
|
||||
</FieldLabel>
|
||||
<Input id="tiktok_url" v-model="form.tiktok_url" type="url"
|
||||
placeholder="https://tiktok.com/@username" />
|
||||
<FieldError :errors="form.errors.tiktok_url ? [form.errors.tiktok_url] : []" />
|
||||
<FieldError :errors="formErrors(form, 'tiktok_url')" />
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { useForm } from '@inertiajs/vue3';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { Save } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import ImageUploadField from '@/components/admin/setting/ImageUploadField.vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Field, FieldError, FieldGroup, FieldLabel, FieldSet } from '@/components/ui/field';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { PhoneNumberInput } from '@/components/ui/phone-number-input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { formErrors } from '@/lib/form';
|
||||
import type { SystemSettingsData } from '@/types/setting';
|
||||
import ImageUploadField from './ImageUploadField.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
data: SystemSettingsData;
|
||||
@ -25,10 +26,34 @@ const form = useForm({
|
||||
login_cover: null as File | null,
|
||||
});
|
||||
|
||||
function buildFormData(): FormData {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('app_name', form.app_name);
|
||||
formData.append('about_app', form.about_app);
|
||||
formData.append('email', form.email);
|
||||
formData.append('phone', form.phone);
|
||||
formData.append('address', form.address);
|
||||
|
||||
if (form.logo) {
|
||||
formData.append('logo', form.logo);
|
||||
}
|
||||
|
||||
if (form.login_cover) {
|
||||
formData.append('login_cover', form.login_cover);
|
||||
}
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
function submit() {
|
||||
form.post('/admin/system/setting/system', {
|
||||
forceFormData: true,
|
||||
const payload = buildFormData();
|
||||
|
||||
form.transform(() => payload).post('/admin/system/setting/system', {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
router.reload({ only: ['name', 'address'] });
|
||||
},
|
||||
onError: () => {
|
||||
toast.error('Gagal menyimpan pengaturan sistem.');
|
||||
},
|
||||
@ -37,15 +62,17 @@ function submit() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="space-y-1">
|
||||
<h2 class="text-2xl font-bold tracking-tight">
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form @submit.prevent="submit">
|
||||
<div class="grid gap-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Informasi Aplikasi</CardTitle>
|
||||
<CardDescription>
|
||||
Nama, deskripsi, dan kontak yang ditampilkan di aplikasi.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FieldSet>
|
||||
<FieldGroup class="grid gap-4 sm:grid-cols-2">
|
||||
@ -54,67 +81,57 @@ function submit() {
|
||||
Nama Aplikasi
|
||||
</FieldLabel>
|
||||
<Input id="app_name" v-model="form.app_name" placeholder="DST Collection" />
|
||||
<FieldError :errors="form.errors.app_name ? [form.errors.app_name] : []" />
|
||||
<FieldError :errors="formErrors(form, 'app_name')" />
|
||||
</Field>
|
||||
|
||||
<Field class="sm:col-span-2">
|
||||
<FieldLabel for="about_app">
|
||||
<FieldLabel for="about_app" required>
|
||||
Tentang Aplikasi
|
||||
</FieldLabel>
|
||||
<Textarea id="about_app" v-model="form.about_app" rows="4"
|
||||
placeholder="Deskripsi singkat tentang bisnis atau aplikasi Anda." />
|
||||
<FieldError :errors="form.errors.about_app ? [form.errors.about_app] : []" />
|
||||
<FieldError :errors="formErrors(form, 'about_app')" />
|
||||
</Field>
|
||||
|
||||
<Field class="sm:col-span-2">
|
||||
<FieldLabel for="address">
|
||||
<FieldLabel for="address" required>
|
||||
Alamat
|
||||
</FieldLabel>
|
||||
<Textarea id="address" v-model="form.address" rows="3"
|
||||
placeholder="Alamat toko yang ditampilkan di struk." />
|
||||
<FieldError :errors="form.errors.address ? [form.errors.address] : []" />
|
||||
<FieldError :errors="formErrors(form, 'address')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="email">
|
||||
<FieldLabel for="email" required>
|
||||
Email
|
||||
</FieldLabel>
|
||||
<Input id="email" v-model="form.email" type="email" placeholder="info@perusahaan.com" />
|
||||
<FieldError :errors="form.errors.email ? [form.errors.email] : []" />
|
||||
<FieldError :errors="formErrors(form, 'email')" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="phone">
|
||||
<FieldLabel for="phone" required>
|
||||
Nomor Telepon
|
||||
</FieldLabel>
|
||||
<PhoneNumberInput id="phone" v-model="form.phone" />
|
||||
<FieldError :errors="form.errors.phone ? [form.errors.phone] : []" />
|
||||
<FieldError :errors="formErrors(form, 'phone')" />
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
|
||||
<FieldGroup class="grid gap-6 sm:grid-cols-2">
|
||||
<ImageUploadField id="logo" v-model="form.logo" label="Logo" required
|
||||
description="Disarankan PNG transparan, maks. 2 MB." :current-url="data.logo_url"
|
||||
:errors="formErrors(form, 'logo')" />
|
||||
|
||||
<ImageUploadField id="login_cover" v-model="form.login_cover" label="Cover Login" required
|
||||
description="Gambar latar halaman login, maks. 5 MB."
|
||||
:current-url="data.login_cover_url" :errors="formErrors(form, 'login_cover')" />
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Branding</CardTitle>
|
||||
<CardDescription>
|
||||
Logo aplikasi dan gambar latar halaman login.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FieldGroup class="grid gap-6 sm:grid-cols-2">
|
||||
<ImageUploadField id="logo" v-model="form.logo" label="Logo" required
|
||||
description="Disarankan PNG transparan, maks. 2 MB." :current-url="data.logo_url"
|
||||
:errors="form.errors.logo ? [form.errors.logo] : []" />
|
||||
|
||||
<ImageUploadField id="login_cover" v-model="form.login_cover" label="Cover Login" required
|
||||
description="Gambar latar halaman login, maks. 5 MB." :current-url="data.login_cover_url"
|
||||
:errors="form.errors.login_cover ? [form.errors.login_cover] : []" />
|
||||
</FieldGroup>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<Button type="submit" :disabled="form.processing">
|
||||
<Save class="size-4" />
|
||||
|
||||
@ -26,8 +26,6 @@ export type MarketplaceSettingsData = {
|
||||
tiktok_shop_affiliate_commission: number;
|
||||
tiktok_shop_shipping_subsidy: number;
|
||||
tiktok_shop_vat_rate: number;
|
||||
tiktok_shop_url: string | null;
|
||||
tiktok_shop_id: string | null;
|
||||
shopee_enabled: boolean;
|
||||
shopee_commission_fee: number;
|
||||
shopee_transaction_fee: number;
|
||||
@ -36,6 +34,4 @@ export type MarketplaceSettingsData = {
|
||||
shopee_affiliate_commission: number;
|
||||
shopee_shipping_subsidy: number;
|
||||
shopee_voucher_fee: number;
|
||||
shopee_shop_url: string | null;
|
||||
shopee_shop_id: string | null;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user