@@ -11,6 +11,8 @@ public partial class DebtModel : ObservableObject
1111 public int BorrowerId { get ; set ; }
1212 public int CurrentUserId { get ; set ; }
1313
14+ public int ? VideoMetadataId { get ; set ; }
15+
1416 [ ObservableProperty ]
1517 private string lenderName = string . Empty ;
1618
@@ -21,14 +23,20 @@ public partial class DebtModel : ObservableObject
2123 private decimal amount ;
2224
2325 [ ObservableProperty ]
26+ [ NotifyPropertyChangedFor ( nameof ( CanMarkAsDefaulted ) ) ]
2427 private DateTime dueDate ;
2528
2629 public string borrowerImageUrl = string . Empty ;
2730
2831 public string lenderImageUrl = string . Empty ;
2932
3033 [ ObservableProperty ]
31- [ NotifyPropertyChangedFor ( nameof ( StatusText ) , nameof ( StatusBrush ) , nameof ( IsActionRequiredForBorrower ) , nameof ( IsRejected ) ) ]
34+ [ NotifyPropertyChangedFor ( nameof ( StatusText ) ) ]
35+ [ NotifyPropertyChangedFor ( nameof ( StatusBrush ) ) ]
36+ [ NotifyPropertyChangedFor ( nameof ( IsActionRequiredForBorrower ) ) ]
37+ [ NotifyPropertyChangedFor ( nameof ( IsRejected ) ) ]
38+ [ NotifyPropertyChangedFor ( nameof ( IsVideoViewableForLender ) ) ]
39+ [ NotifyPropertyChangedFor ( nameof ( CanMarkAsDefaulted ) ) ]
3240 private DebtStatusType status ;
3341
3442 public bool IsCurrentUserTheBorrower => BorrowerId == CurrentUserId ;
@@ -44,13 +52,14 @@ public partial class DebtModel : ObservableObject
4452
4553 public Brush StatusBrush => Status switch
4654 {
47- DebtStatusType . Active => new SolidColorBrush ( Colors . Green ) ,
48- DebtStatusType . Defaulted => new SolidColorBrush ( Colors . DarkRed ) ,
49- DebtStatusType . AcceptedPendingVideoUpload => new SolidColorBrush ( Colors . CornflowerBlue ) ,
50- DebtStatusType . PendingBorrowerAcceptance => new SolidColorBrush ( Colors . DodgerBlue ) ,
51- DebtStatusType . PendingOperatorApproval => new SolidColorBrush ( Colors . Orange ) ,
52- DebtStatusType . RejectedByOperator => new SolidColorBrush ( Colors . Red ) ,
53- DebtStatusType . RejectedByBorrower => new SolidColorBrush ( Colors . Red ) ,
55+ DebtStatusType . Active => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#4CAF50" ) ) , // Green
56+ DebtStatusType . Defaulted => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#B71C1C" ) ) , // Dark Red
57+ DebtStatusType . AcceptedPendingVideoUpload => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#1E88E5" ) ) , // Blue
58+ DebtStatusType . PendingBorrowerAcceptance => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#03A9F4" ) ) , // Light Blue
59+ DebtStatusType . PendingOperatorApproval => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#FB8C00" ) ) , // Orange
60+ DebtStatusType . RejectedByOperator => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#E53935" ) ) , // Red
61+ DebtStatusType . RejectedByBorrower => new SolidColorBrush ( ( Color ) ColorConverter . ConvertFromString ( "#E53935" ) ) , // Red
62+ DebtStatusType . Paid => new SolidColorBrush ( Colors . Gray ) ,
5463 _ => new SolidColorBrush ( Colors . Gray )
5564 } ;
5665
@@ -61,17 +70,32 @@ public partial class DebtModel : ObservableObject
6170 DebtStatusType . PendingOperatorApproval => "Operatör Onayı Bekleniyor" ,
6271 DebtStatusType . Active => "Aktif" ,
6372 DebtStatusType . Paid => "Ödendi" ,
64- DebtStatusType . Defaulted => "Vadesi Geçmiş" ,
73+ DebtStatusType . Defaulted => "Vadesi Geçmiş - Temerrüt " ,
6574 DebtStatusType . RejectedByBorrower => "Tarafınızdan Reddedildi" ,
6675 DebtStatusType . RejectedByOperator => "Operatör Tarafından Reddedildi" ,
6776 _ => "Bilinmeyen Durum"
6877 } ;
6978
70- // Borçlunun video yüklemesi gerekip gerekmediğini kontrol eder.
7179 public bool IsActionRequiredForBorrower =>
7280 Status == DebtStatusType . AcceptedPendingVideoUpload && IsCurrentUserTheBorrower ;
7381
7482 public bool IsRejected =>
7583 Status == DebtStatusType . RejectedByBorrower || Status == DebtStatusType . RejectedByOperator ;
84+
85+ /// <summary>
86+ /// "Teminat Videosunu İzle" düğmesinin görünür olup olmayacağını belirler.
87+ /// </summary>
88+ public bool IsVideoViewableForLender =>
89+ Status == DebtStatusType . Defaulted && // Durum 'Defaulted' olmalı
90+ IsCurrentUserTheLender && // Kullanıcı borç veren olmalı
91+ VideoMetadataId . HasValue ; // İlişkili bir video olmalı
92+
93+ /// <summary>
94+ /// "Temerrüde Düştü Olarak İşaretle" düğmesinin görünür olup olmayacağını belirleyecek.
95+ /// </summary>
96+ public bool CanMarkAsDefaulted =>
97+ Status == DebtStatusType . Active && // Durum 'Active' olmalı
98+ IsCurrentUserTheLender && // Kullanıcı borç veren olmalı
99+ DueDate < DateTime . Now ; // Vadesi geçmiş olmalı
76100 }
77101}
0 commit comments