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 [
|
return [
|
||||||
'app_name' => ['required', 'string', 'max:100'],
|
'app_name' => ['required', 'string', 'max:100'],
|
||||||
'about_app' => ['nullable', 'string'],
|
'about_app' => ['required', 'string'],
|
||||||
'email' => ['nullable', 'email', 'max:100'],
|
'email' => ['required', 'email', 'max:100'],
|
||||||
'phone' => ['nullable', 'string', 'max:20'],
|
'phone' => ['required', 'string', 'max:20'],
|
||||||
'logo' => ['nullable', 'image', 'max:2048'],
|
'address' => ['required', 'string'],
|
||||||
'login_cover' => ['nullable', 'image', 'max:5120'],
|
'logo' => ['required', 'image', 'max:2048'],
|
||||||
|
'login_cover' => ['required', 'image', 'max:5120'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ public function systemData(): array
|
|||||||
'about_app' => $settings->about_app,
|
'about_app' => $settings->about_app,
|
||||||
'email' => $settings->email,
|
'email' => $settings->email,
|
||||||
'phone' => $settings->phone,
|
'phone' => $settings->phone,
|
||||||
|
'address' => $settings->address,
|
||||||
'logo_url' => $logo['url'] ?? null,
|
'logo_url' => $logo['url'] ?? null,
|
||||||
'login_cover_url' => $loginCover['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->about_app = $validated['about_app'] ?? null;
|
||||||
$settings->email = $validated['email'] ?? null;
|
$settings->email = $validated['email'] ?? null;
|
||||||
$settings->phone = $validated['phone'] ?? null;
|
$settings->phone = $validated['phone'] ?? null;
|
||||||
|
$settings->address = $validated['address'] ?? null;
|
||||||
$settings->save();
|
$settings->save();
|
||||||
|
|
||||||
if (isset($validated['logo']) && $validated['logo'] instanceof UploadedFile) {
|
if (isset($validated['logo']) && $validated['logo'] instanceof UploadedFile) {
|
||||||
|
|||||||
@ -8,11 +8,13 @@ class SystemSettings extends Settings
|
|||||||
{
|
{
|
||||||
public string $app_name;
|
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
|
public static function group(): string
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,11 +9,12 @@ public function up(): void
|
|||||||
{
|
{
|
||||||
$this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void {
|
$this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void {
|
||||||
$blueprint->add('app_name', config('app.name', 'DST Collection'));
|
$blueprint->add('app_name', config('app.name', 'DST Collection'));
|
||||||
$blueprint->add('about_app', null);
|
$blueprint->add('address', 'Jl. Raya Cipeundeuy - Pabuaran No.909, Pabuaran, Kec. Pabuaran, Kabupaten Subang, Jawa Barat 41262');
|
||||||
$blueprint->add('email', null);
|
$blueprint->add('about_app', '');
|
||||||
$blueprint->add('phone', null);
|
$blueprint->add('email', '');
|
||||||
$blueprint->add('logo', null);
|
$blueprint->add('phone', '');
|
||||||
$blueprint->add('login_cover', null);
|
$blueprint->add('logo', '');
|
||||||
|
$blueprint->add('login_cover', '');
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void {
|
$this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const form = useForm({
|
|||||||
about_app: props.data.about_app ?? '',
|
about_app: props.data.about_app ?? '',
|
||||||
email: props.data.email ?? '',
|
email: props.data.email ?? '',
|
||||||
phone: props.data.phone ?? '',
|
phone: props.data.phone ?? '',
|
||||||
|
address: props.data.address ?? '',
|
||||||
logo: null as File | null,
|
logo: null as File | null,
|
||||||
login_cover: 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] : []" />
|
<FieldError :errors="form.errors.about_app ? [form.errors.about_app] : []" />
|
||||||
</Field>
|
</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>
|
<Field>
|
||||||
<FieldLabel for="email">
|
<FieldLabel for="email">
|
||||||
Email
|
Email
|
||||||
|
|||||||
@ -4,11 +4,12 @@ export type MarketplacePlatform = 'tiktok_shop' | 'shopee';
|
|||||||
|
|
||||||
export type SystemSettingsData = {
|
export type SystemSettingsData = {
|
||||||
app_name: string;
|
app_name: string;
|
||||||
about_app: string | null;
|
about_app: string;
|
||||||
email: string | null;
|
email: string;
|
||||||
phone: string | null;
|
phone: string;
|
||||||
logo_url: string | null;
|
address: string;
|
||||||
login_cover_url: string | null;
|
logo_url: string;
|
||||||
|
login_cover_url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SocialMediaSettingsData = {
|
export type SocialMediaSettingsData = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user