fix: 🐛 dynamic slug pattern accept int, simpleswitch label are added
This commit is contained in:
parent
946bf6b37e
commit
534a8e849c
4 changed files with 5 additions and 10 deletions
|
|
@ -50,7 +50,7 @@ class StoreDynamicPageRequest extends UpdateDynamicFieldRequest
|
|||
{
|
||||
$rules = [
|
||||
'title' => 'required|string|between:3,255',
|
||||
'slug' => 'required|string|regex:/^[-A-Za-z]{3,255}$/',
|
||||
'slug' => 'required|string|regex:/^[-A-Za-z0-9]{3,255}$/',
|
||||
'page_id' => 'sometimes|nullable|numeric|exists:dynamic_pages,id',
|
||||
'config_id' => 'sometimes|nullable|numeric|exists:page_configs,id',
|
||||
'status' => ['required', new Enum(PageStatusEnum::class)],
|
||||
|
|
|
|||
|
|
@ -128,13 +128,8 @@ export default function DynamicInputs({
|
|||
case enumDynamicFieldTypes.boolean.value:
|
||||
return (
|
||||
<div key={id} className="grid grid-cols-1 gap-1.5">
|
||||
<label
|
||||
htmlFor={`#${fieldName}`}
|
||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
{`${getTrans(field.label)} ${extractRequiredValidation(field.validation) ? " *" : ""}`}
|
||||
</label>
|
||||
<SimpleSwitch
|
||||
label={`${getTrans(field.label)} ${extractRequiredValidation(field.validation) ? " *" : ""}`}
|
||||
name={fieldName}
|
||||
checked={Boolean(fieldValue)}
|
||||
setData={setData}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { Label } from "@/components/ui/label";
|
|||
type SimpleSwitchProps = {
|
||||
name: string;
|
||||
checked?: boolean;
|
||||
label: string;
|
||||
label?: string;
|
||||
leftHelper?: string;
|
||||
rightHelper?: string;
|
||||
required?: boolean;
|
||||
|
|
@ -36,7 +36,7 @@ export default function SimpleSwitch({
|
|||
|
||||
return (
|
||||
<div className="flex flex-col items-start w-fit gap-1.5">
|
||||
<Label htmlFor={name}>{label + (required ? " *" : "")}</Label>
|
||||
{label && (<Label htmlFor={name}>{label + (required ? " *" : "")}</Label>)}
|
||||
<div className="flex items-center gap-3">
|
||||
{leftHelper && (
|
||||
<small>{leftHelper}</small>
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ export default function Form({
|
|||
.value()}
|
||||
wordCounter={false}
|
||||
value={data.slug}
|
||||
pattern="[a-z\-]{3,255}"
|
||||
pattern="[a-z0-9\-]{3,255}"
|
||||
setData={setData}
|
||||
/>
|
||||
<div className="col-span-1 md:col-span-2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue