labour_report_entity.g.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/response/labour_report_entity.dart';
  3. LabourReportEntity $LabourReportEntityFromJson(Map<String, dynamic> json) {
  4. final LabourReportEntity labourReportEntity = LabourReportEntity();
  5. final List<LabourReportRows>? rows = (json['rows'] as List<dynamic>?)?.map(
  6. (e) => jsonConvert.convert<LabourReportRows>(e) as LabourReportRows).toList();
  7. if (rows != null) {
  8. labourReportEntity.rows = rows;
  9. }
  10. final LabourReportTotal? total = jsonConvert.convert<LabourReportTotal>(json['total']);
  11. if (total != null) {
  12. labourReportEntity.total = total;
  13. }
  14. return labourReportEntity;
  15. }
  16. Map<String, dynamic> $LabourReportEntityToJson(LabourReportEntity entity) {
  17. final Map<String, dynamic> data = <String, dynamic>{};
  18. data['rows'] = entity.rows.map((v) => v.toJson()).toList();
  19. data['total'] = entity.total?.toJson();
  20. return data;
  21. }
  22. extension LabourReportEntityExtension on LabourReportEntity {
  23. LabourReportEntity copyWith({
  24. List<LabourReportRows>? rows,
  25. LabourReportTotal? total,
  26. }) {
  27. return LabourReportEntity()
  28. ..rows = rows ?? this.rows
  29. ..total = total ?? this.total;
  30. }
  31. }
  32. LabourReportRows $LabourReportRowsFromJson(Map<String, dynamic> json) {
  33. final LabourReportRows labourReportRows = LabourReportRows();
  34. final int? outletId = jsonConvert.convert<int>(json['outlet_id']);
  35. if (outletId != null) {
  36. labourReportRows.outletId = outletId;
  37. }
  38. final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  39. if (outletName != null) {
  40. labourReportRows.outletName = outletName;
  41. }
  42. final String? hrs = jsonConvert.convert<String>(json['hrs']);
  43. if (hrs != null) {
  44. labourReportRows.hrs = hrs;
  45. }
  46. final String? agAmt = jsonConvert.convert<String>(json['ag_amt']);
  47. if (agAmt != null) {
  48. labourReportRows.agAmt = agAmt;
  49. }
  50. final String? inHrs = jsonConvert.convert<String>(json['in_hrs']);
  51. if (inHrs != null) {
  52. labourReportRows.inHrs = inHrs;
  53. }
  54. final String? inAgAmt = jsonConvert.convert<String>(json['in_ag_amt']);
  55. if (inAgAmt != null) {
  56. labourReportRows.inAgAmt = inAgAmt;
  57. }
  58. final String? totHrs = jsonConvert.convert<String>(json['tot_hrs']);
  59. if (totHrs != null) {
  60. labourReportRows.totHrs = totHrs;
  61. }
  62. final String? totAgAmt = jsonConvert.convert<String>(json['tot_ag_amt']);
  63. if (totAgAmt != null) {
  64. labourReportRows.totAgAmt = totAgAmt;
  65. }
  66. return labourReportRows;
  67. }
  68. Map<String, dynamic> $LabourReportRowsToJson(LabourReportRows entity) {
  69. final Map<String, dynamic> data = <String, dynamic>{};
  70. data['outlet_id'] = entity.outletId;
  71. data['outlet_name'] = entity.outletName;
  72. data['hrs'] = entity.hrs;
  73. data['ag_amt'] = entity.agAmt;
  74. data['in_hrs'] = entity.inHrs;
  75. data['in_ag_amt'] = entity.inAgAmt;
  76. data['tot_hrs'] = entity.totHrs;
  77. data['tot_ag_amt'] = entity.totAgAmt;
  78. return data;
  79. }
  80. extension LabourReportRowsExtension on LabourReportRows {
  81. LabourReportRows copyWith({
  82. int? outletId,
  83. String? outletName,
  84. String? hrs,
  85. String? agAmt,
  86. String? inHrs,
  87. String? inAgAmt,
  88. String? totHrs,
  89. String? totAgAmt,
  90. }) {
  91. return LabourReportRows()
  92. ..outletId = outletId ?? this.outletId
  93. ..outletName = outletName ?? this.outletName
  94. ..hrs = hrs ?? this.hrs
  95. ..agAmt = agAmt ?? this.agAmt
  96. ..inHrs = inHrs ?? this.inHrs
  97. ..inAgAmt = inAgAmt ?? this.inAgAmt
  98. ..totHrs = totHrs ?? this.totHrs
  99. ..totAgAmt = totAgAmt ?? this.totAgAmt;
  100. }
  101. }
  102. LabourReportTotal $LabourReportTotalFromJson(Map<String, dynamic> json) {
  103. final LabourReportTotal labourReportTotal = LabourReportTotal();
  104. final String? hrs = jsonConvert.convert<String>(json['hrs']);
  105. if (hrs != null) {
  106. labourReportTotal.hrs = hrs;
  107. }
  108. final String? agAmt = jsonConvert.convert<String>(json['ag_amt']);
  109. if (agAmt != null) {
  110. labourReportTotal.agAmt = agAmt;
  111. }
  112. final String? inHrs = jsonConvert.convert<String>(json['in_hrs']);
  113. if (inHrs != null) {
  114. labourReportTotal.inHrs = inHrs;
  115. }
  116. final String? inAgAmt = jsonConvert.convert<String>(json['in_ag_amt']);
  117. if (inAgAmt != null) {
  118. labourReportTotal.inAgAmt = inAgAmt;
  119. }
  120. final String? totHrs = jsonConvert.convert<String>(json['tot_hrs']);
  121. if (totHrs != null) {
  122. labourReportTotal.totHrs = totHrs;
  123. }
  124. final String? totAgAmt = jsonConvert.convert<String>(json['tot_ag_amt']);
  125. if (totAgAmt != null) {
  126. labourReportTotal.totAgAmt = totAgAmt;
  127. }
  128. return labourReportTotal;
  129. }
  130. Map<String, dynamic> $LabourReportTotalToJson(LabourReportTotal entity) {
  131. final Map<String, dynamic> data = <String, dynamic>{};
  132. data['hrs'] = entity.hrs;
  133. data['ag_amt'] = entity.agAmt;
  134. data['in_hrs'] = entity.inHrs;
  135. data['in_ag_amt'] = entity.inAgAmt;
  136. data['tot_hrs'] = entity.totHrs;
  137. data['tot_ag_amt'] = entity.totAgAmt;
  138. return data;
  139. }
  140. extension LabourReportTotalExtension on LabourReportTotal {
  141. LabourReportTotal copyWith({
  142. String? hrs,
  143. String? agAmt,
  144. String? inHrs,
  145. String? inAgAmt,
  146. String? totHrs,
  147. String? totAgAmt,
  148. }) {
  149. return LabourReportTotal()
  150. ..hrs = hrs ?? this.hrs
  151. ..agAmt = agAmt ?? this.agAmt
  152. ..inHrs = inHrs ?? this.inHrs
  153. ..inAgAmt = inAgAmt ?? this.inAgAmt
  154. ..totHrs = totHrs ?? this.totHrs
  155. ..totAgAmt = totAgAmt ?? this.totAgAmt;
  156. }
  157. }