feat: expose End Validity in plan creation modal and handle optional input

This commit is contained in:
Luis Gabriel Ramos Robles 2026-06-14 02:18:45 +00:00
parent 422e400613
commit bff2c3974e
3 changed files with 18 additions and 2 deletions

View file

@ -36,6 +36,7 @@ export default function PlansPage() {
const [name, setName] = useState('');
const [code, setCode] = useState('');
const [validityStart, setValidityStart] = useState('');
const [validityEnd, setValidityEnd] = useState('');
const [type, setType] = useState('PERCENTAGE');
const [metaAmount, setMetaAmount] = useState('');
const [percentageRate, setPercentageRate] = useState('');
@ -86,6 +87,7 @@ export default function PlansPage() {
name,
code,
validityStart,
validityEnd: validityEnd || undefined,
type,
metaAmount: metaAmount ? parseFloat(metaAmount) : undefined,
percentageRate: percentageRate ? parseFloat(percentageRate) : undefined,
@ -105,6 +107,7 @@ export default function PlansPage() {
setName('');
setCode('');
setValidityStart('');
setValidityEnd('');
setType('PERCENTAGE');
setMetaAmount('');
setPercentageRate('');
@ -263,6 +266,17 @@ export default function PlansPage() {
/>
</div>
<div className={styles.formGroup}>
<label className={styles.label} htmlFor="plan-validity-end">{t('plans.modalValidityEnd')}</label>
<input
id="plan-validity-end"
type="date"
className={styles.input}
value={validityEnd}
onChange={(e) => setValidityEnd(e.target.value)}
/>
</div>
<div className={styles.formGroup}>
<label className={styles.label} htmlFor="plan-type">{t('plans.modalType')}</label>
<select

View file

@ -148,7 +148,8 @@
"FIXED": "Fixed Commission"
},
"errorFind": "Could not find the plan.",
"errorLoad": "Error loading plan information."
"errorLoad": "Error loading plan information.",
"modalValidityEnd": "End Validity (Optional)"
},
"rules": {
"back": "Back to Plans",

View file

@ -148,7 +148,8 @@
"FIXED": "Comisión Fija"
},
"errorFind": "No se pudo encontrar el plan.",
"errorLoad": "Error al cargar la información del plan."
"errorLoad": "Error al cargar la información del plan.",
"modalValidityEnd": "Fin de Vigencia (Opcional)"
},
"rules": {
"back": "Volver a Planes",