@@ -459,17 +459,17 @@ def build_edit_content(self, entity: Optional[Contract]) -> list:
459459
460460 save_label = "Create Contract" if is_new else "Save Changes"
461461
462- # -- Compact multi -column layout --
462+ # -- Multi -column layout --
463463 self ._title_field .col = {"xs" : 12 , "sm" : 6 }
464464 self ._clients_field .col = {"xs" : 12 , "sm" : 6 }
465- self ._rate_field .col = {"xs" : 6 , "sm" : 3 }
466- self ._currency_field .col = {"xs" : 6 , "sm" : 3 }
467- self ._time_unit_field .col = {"xs" : 6 , "sm" : 3 }
468- self ._billing_field .col = {"xs" : 6 , "sm" : 3 }
469- self ._vat_field .col = {"xs" : 6 , "sm" : 3 }
470- self ._unit_pw_field .col = {"xs" : 6 , "sm" : 3 }
471- self ._volume_field .col = {"xs" : 6 , "sm" : 3 }
472- self ._top_field .col = {"xs" : 6 , "sm" : 3 }
465+ self ._rate_field .col = {"xs" : 6 , "sm" : 4 }
466+ self ._currency_field .col = {"xs" : 6 , "sm" : 4 }
467+ self ._time_unit_field .col = {"xs" : 6 , "sm" : 4 }
468+ self ._billing_field .col = {"xs" : 6 , "sm" : 6 }
469+ self ._vat_field .col = {"xs" : 6 , "sm" : 6 }
470+ self ._unit_pw_field .col = {"xs" : 6 , "sm" : 6 }
471+ self ._volume_field .col = {"xs" : 6 , "sm" : 6 }
472+ self ._top_field .col = {"xs" : 6 , "sm" : 6 }
473473 self ._sig_date_field .col = {"xs" : 12 , "sm" : 4 }
474474 self ._start_date_field .col = {"xs" : 6 , "sm" : 4 }
475475 self ._end_date_field .col = {"xs" : 6 , "sm" : 4 }
@@ -479,24 +479,34 @@ def build_edit_content(self, entity: Optional[Contract]) -> list:
479479 controls = [self ._title_field , self ._clients_field ],
480480 spacing = dimens .SPACE_SM ,
481481 ),
482+ views .SectionLabel ("Pricing" ),
482483 ResponsiveRow (
483484 controls = [
484485 self ._rate_field ,
485486 self ._currency_field ,
486487 self ._time_unit_field ,
487- self ._billing_field ,
488488 ],
489489 spacing = dimens .SPACE_SM ,
490490 ),
491491 ResponsiveRow (
492492 controls = [
493+ self ._billing_field ,
493494 self ._vat_field ,
495+ ],
496+ spacing = dimens .SPACE_SM ,
497+ ),
498+ ResponsiveRow (
499+ controls = [
494500 self ._unit_pw_field ,
495501 self ._volume_field ,
496- self ._top_field ,
497502 ],
498503 spacing = dimens .SPACE_SM ,
499504 ),
505+ ResponsiveRow (
506+ controls = [self ._top_field ],
507+ spacing = dimens .SPACE_SM ,
508+ ),
509+ views .SectionLabel ("Dates" ),
500510 ResponsiveRow (
501511 controls = [
502512 self ._sig_date_field ,
@@ -561,8 +571,16 @@ def _validate_and_save(self):
561571 start_date = self ._start_date_field .get_date ()
562572 end_date = self ._end_date_field .get_date ()
563573 if not sig_date or not start_date or not end_date :
574+ self ._sig_date_field .set_error (not sig_date )
575+ self ._start_date_field .set_error (not start_date )
576+ self ._end_date_field .set_error (not end_date )
577+ self .update ()
564578 return
565579 if end_date < start_date :
580+ self ._end_date_field .set_error (
581+ True , "'Valid until' must be after 'Valid from'"
582+ )
583+ self .update ()
566584 return
567585 vat_rate = self ._vat_field .value or CONTRACT_DEFAULT_VAT_RATE
568586
0 commit comments