Skip to content

Commit

Permalink
Merge branch 'feature/contracts' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dragos1195 committed Oct 2, 2024
2 parents c852b02 + d6fda7f commit 238fc3f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ export class DocumentContractListViewRepository extends RepositoryWithPagination
if (search) {
query.andWhere(
this.buildBracketSearchQuery(
['documentContractListView.documentNumber', 'user.name'],
[
'documentContractListView.documentNumber',
'documentContractListView.volunteerName',
],
search,
),
);
Expand Down
104 changes: 55 additions & 49 deletions frontend/src/components/AutoFillContractCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,57 +64,63 @@ export const AutoFillContractCard = ({ onSubmit }: AutoFillContractCardProps) =>
<div className="bg-white rounded shadow flex flex-col p-4 gap-4">
<p className="font-robotoBold">{t('title')}</p>
<p className="text-cool-gray-700">{t('description')}</p>
<div className="flex flex-col md:flex-row items-start gap-6 sm:h-24">
<Controller
name="startingNumber"
control={control}
render={({ field: { value, onChange } }) => {
return (
<FormInput
label={t('form.starting_number')}
value={value ?? ''}
onChange={onChange}
placeholder="Introdu numarul"
wrapperClassname="flex-1 justify-between"
type="number"
errorMessage={errors.startingNumber ? t('required', { ns: 'general' }) : ''}
/>
);
}}
/>
<Controller
name="documentContractDate"
control={control}
render={({ field: { value, onChange } }) => (
<div className="flex-1 min-w-0">
<FormDatePicker
label={t('form.contract_date')}
placeholder="ZZ.LL.AAAA"
<div className="flex flex-col md:flex-row items-start gap-6 md:h-24">
<div className="w-full">
<Controller
name="startingNumber"
control={control}
render={({ field: { value, onChange } }) => {
return (
<FormInput
label={t('form.starting_number')}
value={value ?? ''}
onChange={onChange}
placeholder="Introdu numarul"
wrapperClassname="flex-1 justify-between"
type="number"
errorMessage={errors.startingNumber ? t('required', { ns: 'general' }) : ''}
/>
);
}}
/>

</div>
<div className="w-full">
<Controller
name="documentContractDate"
control={control}
render={({ field: { value, onChange } }) => (
<div className="flex-1 min-w-0">
<FormDatePicker
label={t('form.contract_date')}
placeholder="ZZ.LL.AAAA"
value={value}
onChange={onChange}
minDate={new Date()}
maxDate={new Date(new Date().setMonth(new Date().getMonth() + 6))}
errorMessage={errors.documentContractDate ? t('required', { ns: 'general' }) : ''}
wrapperClassName="h-full justify-between"
/>
</div>
)}
/>
</div>
<div className="w-full">
<Controller
name="documentContractPeriod"
control={control}
render={({ field: { value, onChange } }) => (
<DateRangePicker
label={t('form.contract_period')}
className="flex-1 justify-between"
value={value}
onChange={onChange}
minDate={new Date()}
maxDate={new Date(new Date().setMonth(new Date().getMonth() + 6))}
errorMessage={errors.documentContractDate ? t('required', { ns: 'general' }) : ''}
wrapperClassName="h-full justify-between"
minDate={documentContractDate}
errorMessage={errors.documentContractPeriod ? t('required', { ns: 'general' }) : ''}
/>
</div>
)}
/>

<Controller
name="documentContractPeriod"
control={control}
render={({ field: { value, onChange } }) => (
<DateRangePicker
label={t('form.contract_period')}
className="flex-1 justify-between"
value={value}
onChange={onChange}
minDate={documentContractDate}
errorMessage={errors.documentContractPeriod ? t('required', { ns: 'general' }) : ''}
/>
)}
/>
)}
/>
</div>
</div>
<div className="flex flex-col sm:flex-row gap-4">
<Button
Expand All @@ -128,7 +134,7 @@ export const AutoFillContractCard = ({ onSubmit }: AutoFillContractCardProps) =>
onClick={handleSubmit(onSubmit)}
/>
</div>
</div>
</div >
</>
);
};
2 changes: 1 addition & 1 deletion frontend/src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface InputProps extends ComponentPropsWithoutRef<'input'> {
const Input = ({ label, helper, wrapperClassname, ...props }: InputProps) => {
return (
<div className={`flex gap-1 flex-col ${wrapperClassname}`}>
{label && <label htmlFor={`${label}__input`}>{label}</label>}
{label && <label htmlFor={`${label}__input`} className="text-ellipsis text-nowrap">{label}</label>}
<input id={`${label}__input`} {...props} />
{helper}
</div>
Expand Down

0 comments on commit 238fc3f

Please sign in to comment.