labour_report_entity.g.dart 5.3 KB

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