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

View file

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

View file

@ -148,7 +148,8 @@
"FIXED": "Comisión Fija" "FIXED": "Comisión Fija"
}, },
"errorFind": "No se pudo encontrar el plan.", "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": { "rules": {
"back": "Volver a Planes", "back": "Volver a Planes",