save before flutter upgrade

This commit is contained in:
Abraham
2025-07-15 16:40:14 -07:00
commit 813c586a1c
197 changed files with 11144 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import 'dart:convert';
import 'package:nethive_neo/models/state.dart';
class Address {
Address({
required this.id,
required this.address1,
required this.address2,
required this.zipcode,
required this.city,
required this.stateFk,
required this.state,
required this.country,
});
int id;
String address1;
String? address2;
String zipcode;
String city;
int stateFk;
StateAPI state;
String country;
String get fullAddress => '$address1 $city, ${state.code} $zipcode $country';
factory Address.fromJson(String str) => Address.fromMap(json.decode(str));
factory Address.fromMap(Map<String, dynamic> json) {
Address address = Address(
id: json["address_id"],
address1: json['address_1'],
address2: json['address_2'],
zipcode: json['zipcode'],
city: json['city'],
stateFk: json['state_fk'],
state: StateAPI.fromMap(json['state']),
country: json['country'],
);
return address;
}
}

View File

@@ -0,0 +1,31 @@
import 'dart:convert';
class BillCycle {
BillCycle({
required this.customerId,
required this.day,
required this.billDueDay,
required this.graceDays,
required this.frequency,
});
int customerId;
int day;
int billDueDay;
int graceDays;
int frequency;
factory BillCycle.fromJson(String str) => BillCycle.fromMap(json.decode(str));
factory BillCycle.fromMap(Map<String, dynamic> json) {
BillCycle billCycle = BillCycle(
customerId: json["customer_id"],
day: json['day'],
billDueDay: json['bill_due_day'],
graceDays: json['grace_days'],
frequency: json['frequency'],
);
return billCycle;
}
}

View File

@@ -0,0 +1,33 @@
import 'dart:convert';
class CreditCard {
CreditCard({
required this.creditCardId,
required this.type,
required this.token,
required this.automatic,
required this.customerFk,
});
int creditCardId;
String type;
String token;
bool automatic;
int customerFk;
String get last4Digits => token.substring(token.length - 4);
factory CreditCard.fromJson(String str) => CreditCard.fromMap(json.decode(str));
factory CreditCard.fromMap(Map<String, dynamic> json) {
CreditCard creditCard = CreditCard(
creditCardId: json["credit_card_id"],
type: json['type'] ?? 'Credit Card',
token: json['token'],
automatic: json['automatic'] ?? true,
customerFk: json['customer_fk'],
);
return creditCard;
}
}

View File

@@ -0,0 +1,45 @@
import 'dart:convert';
class Customer {
Customer({
required this.id,
required this.firstName,
required this.lastName,
required this.email,
required this.createdAt,
required this.status,
required this.phoneNumber,
required this.balance,
this.image,
});
int id;
String firstName;
String lastName;
String email;
DateTime createdAt;
String status;
String phoneNumber;
num balance;
String? image;
String get fullName => '$firstName $lastName';
factory Customer.fromJson(String str) => Customer.fromMap(json.decode(str));
factory Customer.fromMap(Map<String, dynamic> json) {
Customer customer = Customer(
id: json["customer_id"],
firstName: json['first_name'],
lastName: json['last_name'],
email: json["email"],
createdAt: DateTime.parse(json['created_at']),
status: json['status'],
phoneNumber: json['mobile_phone'],
balance: json['balance'] ?? 0.00,
image: json['image'],
);
return customer;
}
}

View File

@@ -0,0 +1,37 @@
import 'dart:convert';
class CustomerDashboards {
int? customerId;
DateTime? createdAt;
String? firstName;
String? lastName;
String? status;
CustomerDashboards({
this.customerId,
this.createdAt,
this.firstName,
this.lastName,
this.status,
});
factory CustomerDashboards.fromJson(String str) => CustomerDashboards.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory CustomerDashboards.fromMap(Map<String, dynamic> json) => CustomerDashboards(
customerId: json["customer_id"],
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
firstName: json["first_name"],
lastName: json["last_name"],
status: json["status"],
);
Map<String, dynamic> toMap() => {
"customer_id": customerId,
"created_at": createdAt?.toIso8601String(),
"first_name": firstName,
"last_name": lastName,
"status": status,
};
}

View File

@@ -0,0 +1,72 @@
import 'dart:convert';
import 'package:nethive_neo/models/models.dart';
class CustomerDetails {
CustomerDetails({
required this.id,
required this.createdDate,
required this.firstName,
required this.lastName,
required this.email,
required this.billingAddress,
required this.status,
required this.phoneNumber,
required this.balance,
this.image,
required this.billCycle,
required this.services,
required this.notes,
required this.messages,
});
int id;
DateTime createdDate;
String firstName;
String lastName;
String email;
Address billingAddress;
String status;
String phoneNumber;
num balance;
String? image;
BillCycle billCycle;
List<Service> services;
List<Note> notes;
List<Message> messages;
String get fullName => '$firstName $lastName';
DateTime get billingDate {
final now = DateTime.now();
return DateTime(now.year, now.month, billCycle.day);
}
factory CustomerDetails.fromJson(String str) =>
CustomerDetails.fromMap(json.decode(str));
factory CustomerDetails.fromMap(Map<String, dynamic> json) {
CustomerDetails customer = CustomerDetails(
id: json["customer_id"],
createdDate: DateTime.parse(json['created_date']),
firstName: json['first_name'],
lastName: json['last_name'],
email: json["email"],
billingAddress: Address.fromMap(json['billing_address']),
status: json['status'],
phoneNumber: json['mobile_phone'],
balance: json['balance'] ?? 0.00,
image: json['image'],
billCycle: BillCycle.fromMap(json['billing_cycle']),
services: (json['services'] as List)
.map((service) => Service.fromMap(service))
.toList(),
notes: (json['notes'] as List).map((note) => Note.fromMap(note)).toList(),
messages: (json['messages'] as List)
.map((note) => Message.fromMap(note))
.toList(),
);
return customer;
}
}

View File

@@ -0,0 +1,73 @@
import 'dart:convert';
class CustomerMarcadores {
int? id;
DateTime? createdAt;
double? customersTotals;
double? activeTotals;
double? leadTotals;
List<NewCustomersId>? newCustomersId;
CustomerMarcadores({
this.id,
this.createdAt,
this.customersTotals,
this.activeTotals,
this.leadTotals,
this.newCustomersId,
});
factory CustomerMarcadores.fromJson(String str) => CustomerMarcadores.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory CustomerMarcadores.fromMap(Map<String, dynamic> json) => CustomerMarcadores(
id: json["id"],
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
customersTotals: json["customers_totals"],
activeTotals: json["active_totals"],
leadTotals: json["lead_totals"],
newCustomersId: json["new_customers_id"] == null ? [] : List<NewCustomersId>.from(json["new_customers_id"]!.map((x) => NewCustomersId.fromMap(x))),
);
Map<String, dynamic> toMap() => {
"id": id,
"created_at": createdAt?.toIso8601String(),
"customers_totals": customersTotals,
"active_totals": activeTotals,
"lead_totals": leadTotals,
"new_customers_id": newCustomersId == null ? [] : List<dynamic>.from(newCustomersId!.map((x) => x.toMap())),
};
}
class NewCustomersId {
int? count;
String? status;
DateTime? createdAt;
List<int>? customerIds;
NewCustomersId({
this.count,
this.status,
this.createdAt,
this.customerIds,
});
factory NewCustomersId.fromJson(String str) => NewCustomersId.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory NewCustomersId.fromMap(Map<String, dynamic> json) => NewCustomersId(
count: json["count"],
status: json["status"],
createdAt: json["created_at"] == null ? null : DateTime.parse(json["created_at"]),
customerIds: json["customer_ids"] == null ? [] : List<int>.from(json["customer_ids"]!.map((x) => x)),
);
Map<String, dynamic> toMap() => {
"count": count,
"status": status,
"created_at": "${createdAt!.year.toString().padLeft(4, '0')}-${createdAt!.month.toString().padLeft(2, '0')}-${createdAt!.day.toString().padLeft(2, '0')}",
"customer_ids": customerIds == null ? [] : List<dynamic>.from(customerIds!.map((x) => x)),
};
}

View File

@@ -0,0 +1,47 @@
import 'dart:convert';
class CustomerSubscription {
int subscriptionId;
String description;
double amount;
String status;
String createdAt;
String periodStart;
String? periodEnd;
CustomerSubscription({
required this.subscriptionId,
required this.description,
required this.amount,
required this.status,
required this.createdAt,
required this.periodStart,
required this.periodEnd,
});
factory CustomerSubscription.fromJson(String str) =>
CustomerSubscription.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory CustomerSubscription.fromMap(Map<String, dynamic> json) =>
CustomerSubscription(
subscriptionId: json["subscription_id"],
description: json["description"],
amount: json["amount"],
status: json["status"],
createdAt: json["created_at"],
periodStart: json["period_start"],
periodEnd: json["period_end"],
);
Map<String, dynamic> toMap() => {
"subscription_id": subscriptionId,
"description": description,
"amount": amount,
"status": status,
"created_at": createdAt,
"period_start": periodStart,
"period_end": periodEnd,
};
}

View File

@@ -0,0 +1,57 @@
import 'dart:convert';
class HeatmapCustomers {
int? year;
int? month;
Registro? registro;
HeatmapCustomers({
this.year,
this.month,
this.registro,
});
factory HeatmapCustomers.fromJson(String str) => HeatmapCustomers.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory HeatmapCustomers.fromMap(Map<String, dynamic> json) => HeatmapCustomers(
year: json["year"],
month: json["month"],
registro: json["registro"] == null ? null : Registro.fromMap(json["registro"]),
);
Map<String, dynamic> toMap() => {
"year": year,
"month": month,
"registro": registro?.toMap(),
};
}
class Registro {
double? leads;
double? total;
double? actives;
Registro({
this.leads,
this.total,
this.actives,
});
factory Registro.fromJson(String str) => Registro.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory Registro.fromMap(Map<String, dynamic> json) => Registro(
leads: json["Leads"],
total: json["Total"],
actives: json["Actives"],
);
Map<String, dynamic> toMap() => {
"Leads": leads,
"Total": total,
"Actives": actives,
};
}

View File

@@ -0,0 +1,25 @@
import 'dart:convert';
class Invoice {
Invoice({
required this.invoiceId,
required this.date,
required this.code,
});
int invoiceId;
DateTime date;
String code;
factory Invoice.fromJson(String str) => Invoice.fromMap(json.decode(str));
factory Invoice.fromMap(Map<String, dynamic> json) {
Invoice invoice = Invoice(
invoiceId: json['invoice_id'],
date: DateTime.parse(json["created_at"]),
code: json['invoice'],
);
return invoice;
}
}

View File

@@ -0,0 +1,26 @@
import 'dart:convert';
class Message {
Message({
required this.messageId,
required this.createdAt,
required this.customerFk,
required this.text,
});
int messageId;
DateTime createdAt;
int customerFk;
String text;
factory Message.fromJson(String str) => Message.fromMap(json.decode(str));
factory Message.fromMap(Map<String, dynamic> json) {
return Message(
messageId: json["notification_id"],
createdAt: DateTime.parse(json["created_at"]),
customerFk: json['from'],
text: json['message'] ?? '',
);
}
}

View File

@@ -0,0 +1,28 @@
import 'dart:convert';
class Note {
Note({
required this.noteId,
required this.createdAt,
required this.customerFk,
required this.text,
});
int noteId;
DateTime createdAt;
int customerFk;
String text;
factory Note.fromJson(String str) => Note.fromMap(json.decode(str));
factory Note.fromMap(Map<String, dynamic> json) {
Note note = Note(
noteId: json["note_id"],
createdAt: DateTime.parse(json["created_at"]),
customerFk: json['customer_fk'],
text: json['note'] ?? '',
);
return note;
}
}

View File

@@ -0,0 +1,44 @@
import 'dart:convert';
class Payment {
Payment({
required this.paymentId,
required this.transactionId,
required this.date,
required this.method,
required this.description,
required this.status,
required this.amount,
required this.error,
});
int transactionId;
int paymentId;
DateTime date;
String method;
String description;
String status;
num amount;
String error;
// String get displayValue => creditCard == '-' ? creditCard : '****$last4Digits';
// String get last4Digits => creditCard.substring(creditCard.length - 4);
factory Payment.fromJson(String str) => Payment.fromMap(json.decode(str));
factory Payment.fromMap(Map<String, dynamic> json) {
Payment payment = Payment(
paymentId: json['payment_id'],
transactionId: json['transaction_id'],
date: DateTime.parse(json["date"]),
method: json['method'],
description: json['description'],
status: json['status'],
amount: json['amount'],
error: json['error'] ?? '',
);
return payment;
}
}

View File

@@ -0,0 +1,26 @@
import 'dart:convert';
class RecentActivity {
RecentActivity({
required this.recentActivityId,
required this.createdAt,
required this.customerFk,
required this.activity,
});
int recentActivityId;
DateTime createdAt;
int customerFk;
String activity;
factory RecentActivity.fromJson(String str) => RecentActivity.fromMap(json.decode(str));
factory RecentActivity.fromMap(Map<String, dynamic> json) {
return RecentActivity(
recentActivityId: json["recent_activity_id"],
createdAt: DateTime.parse(json["created_at"]),
customerFk: json['customer_fk'],
activity: json['activity'],
);
}
}

View File

@@ -0,0 +1,30 @@
import 'dart:convert';
class Transaction {
Transaction(
{required this.date,
required this.description,
required this.type,
required this.amount,
required this.status});
DateTime date;
String description;
String type;
num amount;
String status;
factory Transaction.fromJson(String str) =>
Transaction.fromMap(json.decode(str));
factory Transaction.fromMap(Map<String, dynamic> json) {
Transaction transaction = Transaction(
date: DateTime.parse(json["created_at"]),
description: json['description'],
type: json['type_transaction'],
amount: json['total_amout'],
status: json['status']);
return transaction;
}
}