Update SystemRequest, SystemService, and SystemSettings to require address, email, phone, and about_app fields. Modify database migration to set default values for new fields. Enhance SystemSection component to include address input and update TypeScript definitions accordingly.
This commit is contained in:
parent
87fd3b791c
commit
5233890030
@ -16,11 +16,12 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'app_name' => ['required', 'string', 'max:100'],
|
||||
'about_app' => ['nullable', 'string'],
|
||||
'email' => ['nullable', 'email', 'max:100'],
|
||||
'phone' => ['nullable', 'string', 'max:20'],
|
||||
'logo' => ['nullable', 'image', 'max:2048'],
|
||||
'login_cover' => ['nullable', 'image', 'max:5120'],
|
||||
'about_app' => ['required', 'string'],
|
||||
'email' => ['required', 'email', 'max:100'],
|
||||
'phone' => ['required', 'string', 'max:20'],
|
||||
'address' => ['required', 'string'],
|
||||
'logo' => ['required', 'image', 'max:2048'],
|
||||
'login_cover' => ['required', 'image', 'max:5120'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ public function systemData(): array
|
||||
'about_app' => $settings->about_app,
|
||||
'email' => $settings->email,
|
||||
'phone' => $settings->phone,
|
||||
'address' => $settings->address,
|
||||
'logo_url' => $logo['url'] ?? null,
|
||||
'login_cover_url' => $loginCover['url'] ?? null,
|
||||
];
|
||||
@ -43,6 +44,7 @@ public function updateSystem(array $validated): void
|
||||
$settings->about_app = $validated['about_app'] ?? null;
|
||||
$settings->email = $validated['email'] ?? null;
|
||||
$settings->phone = $validated['phone'] ?? null;
|
||||
$settings->address = $validated['address'] ?? null;
|
||||
$settings->save();
|
||||
|
||||
if (isset($validated['logo']) && $validated['logo'] instanceof UploadedFile) {
|
||||
|
||||
@ -8,11 +8,13 @@ class SystemSettings extends Settings
|
||||
{
|
||||
public string $app_name;
|
||||
|
||||
public ?string $about_app;
|
||||
public string $about_app;
|
||||
|
||||
public ?string $email;
|
||||
public string $email;
|
||||
|
||||
public ?string $phone;
|
||||
public string $phone;
|
||||
|
||||
public string $address;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
|
||||
@ -9,11 +9,12 @@ public function up(): void
|
||||
{
|
||||
$this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void {
|
||||
$blueprint->add('app_name', config('app.name', 'DST Collection'));
|
||||
$blueprint->add('about_app', null);
|
||||
$blueprint->add('email', null);
|
||||
$blueprint->add('phone', null);
|
||||
$blueprint->add('logo', null);
|
||||
$blueprint->add('login_cover', null);
|
||||
$blueprint->add('address', 'Jl. Raya Cipeundeuy - Pabuaran No.909, Pabuaran, Kec. Pabuaran, Kabupaten Subang, Jawa Barat 41262');
|
||||
$blueprint->add('about_app', '');
|
||||
$blueprint->add('email', '');
|
||||
$blueprint->add('phone', '');
|
||||
$blueprint->add('logo', '');
|
||||
$blueprint->add('login_cover', '');
|
||||
});
|
||||
|
||||
$this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void {
|
||||
|
||||
@ -20,6 +20,7 @@ const form = useForm({
|
||||
about_app: props.data.about_app ?? '',
|
||||
email: props.data.email ?? '',
|
||||
phone: props.data.phone ?? '',
|
||||
address: props.data.address ?? '',
|
||||
logo: null as File | null,
|
||||
login_cover: null as File | null,
|
||||
});
|
||||
@ -65,6 +66,15 @@ function submit() {
|
||||
<FieldError :errors="form.errors.about_app ? [form.errors.about_app] : []" />
|
||||
</Field>
|
||||
|
||||
<Field class="sm:col-span-2">
|
||||
<FieldLabel for="address">
|
||||
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] : []" />
|
||||
</Field>
|
||||
|
||||
<Field>
|
||||
<FieldLabel for="email">
|
||||
Email
|
||||
|
||||
@ -4,11 +4,12 @@ export type MarketplacePlatform = 'tiktok_shop' | 'shopee';
|
||||
|
||||
export type SystemSettingsData = {
|
||||
app_name: string;
|
||||
about_app: string | null;
|
||||
email: string | null;
|
||||
phone: string | null;
|
||||
logo_url: string | null;
|
||||
login_cover_url: string | null;
|
||||
about_app: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
address: string;
|
||||
logo_url: string;
|
||||
login_cover_url: string;
|
||||
};
|
||||
|
||||
export type SocialMediaSettingsData = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user