You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/service_request/supplier_details.dart

418 lines
10 KiB
Dart

import 'package:test_sa/models/base.dart';
class SupplierDetails extends Base {
SupplierDetails({
this.id,
this.suppliername,
this.nameX,
this.website,
this.email,
this.code,
this.suppNo,
this.suppStatusId,
this.cityId,
this.person,
this.comment,
this.zipcode,
this.contact,
this.telephones,
this.faxes,
this.addresses,
this.attachments,
this.suppPersons,
this.suppTCodes,
}) : super(name: suppliername, identifier: id?.toString());
SupplierDetails.fromJson(dynamic json) {
id = json['id'];
identifier = id?.toString();
suppliername = json['suppliername'];
name = suppliername;
nameX = json['name'];
website = json['website'];
email = json['email'];
code = json['code'];
suppNo = json['suppNo'];
suppStatusId = json['suppStatusId'];
cityId = json['cityId'];
person = json['person'];
comment = json['comment'];
zipcode = json['zipcode'];
contact = json['contact'];
if (json['telephones'] != null) {
telephones = [];
json['telephones'].forEach((v) {
telephones.add(Telephones.fromJson(v));
});
}
if (json['faxes'] != null) {
faxes = [];
json['faxes'].forEach((v) {
faxes.add(Faxes.fromJson(v));
});
}
if (json['addresses'] != null) {
addresses = [];
json['addresses'].forEach((v) {
addresses.add(Addresses.fromJson(v));
});
}
if (json['attachments'] != null) {
attachments = [];
json['attachments'].forEach((v) {
attachments.add(Attachments.fromJson(v));
});
}
if (json['suppPersons'] != null) {
suppPersons = [];
json['suppPersons'].forEach((v) {
suppPersons.add(SuppPersons.fromJson(v));
});
}
if (json['suppTCodes'] != null) {
suppTCodes = [];
json['suppTCodes'].forEach((v) {
suppTCodes.add(SuppTCodes.fromJson(v));
});
}
}
num id;
String suppliername;
String nameX;
String website;
String email;
String code;
num suppNo;
num suppStatusId;
num cityId;
String person;
String comment;
num zipcode;
String contact;
List<Telephones> telephones;
List<Faxes> faxes;
List<Addresses> addresses;
List<Attachments> attachments;
List<SuppPersons> suppPersons;
List<SuppTCodes> suppTCodes;
SupplierDetails copyWith({
num id,
String suppliername,
String nameX,
String website,
String email,
String code,
num suppNo,
num suppStatusId,
num cityId,
String person,
String comment,
num zipcode,
String contact,
List<Telephones> telephones,
List<Faxes> faxes,
List<Addresses> addresses,
List<Attachments> attachments,
List<SuppPersons> suppPersons,
List<SuppTCodes> suppTCodes,
}) =>
SupplierDetails(
id: id ?? this.id,
suppliername: suppliername ?? this.suppliername,
nameX: nameX ?? this.nameX,
website: website ?? this.website,
email: email ?? this.email,
code: code ?? this.code,
suppNo: suppNo ?? this.suppNo,
suppStatusId: suppStatusId ?? this.suppStatusId,
cityId: cityId ?? this.cityId,
person: person ?? this.person,
comment: comment ?? this.comment,
zipcode: zipcode ?? this.zipcode,
contact: contact ?? this.contact,
telephones: telephones ?? this.telephones,
faxes: faxes ?? this.faxes,
addresses: addresses ?? this.addresses,
attachments: attachments ?? this.attachments,
suppPersons: suppPersons ?? this.suppPersons,
suppTCodes: suppTCodes ?? this.suppTCodes,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['suppliername'] = suppliername;
map['name'] = nameX;
map['website'] = website;
map['email'] = email;
map['code'] = code;
map['suppNo'] = suppNo;
map['suppStatusId'] = suppStatusId;
map['cityId'] = cityId;
map['person'] = person;
map['comment'] = comment;
map['zipcode'] = zipcode;
map['contact'] = contact;
if (telephones != null) {
map['telephones'] = telephones.map((v) => v.toJson()).toList();
}
if (faxes != null) {
map['faxes'] = faxes.map((v) => v.toJson()).toList();
}
if (addresses != null) {
map['addresses'] = addresses.map((v) => v.toJson()).toList();
}
if (attachments != null) {
map['attachments'] = attachments.map((v) => v.toJson()).toList();
}
if (suppPersons != null) {
map['suppPersons'] = suppPersons.map((v) => v.toJson()).toList();
}
if (suppTCodes != null) {
map['suppTCodes'] = suppTCodes.map((v) => v.toJson()).toList();
}
return map;
}
}
class SuppTCodes {
SuppTCodes({
this.id,
this.supplierId,
this.codeTypeId,
this.codeValue,
});
SuppTCodes.fromJson(dynamic json) {
id = json['id'];
supplierId = json['supplierId'];
codeTypeId = json['codeTypeId'];
codeValue = json['codeValue'];
}
num id;
num supplierId;
num codeTypeId;
String codeValue;
SuppTCodes copyWith({
num id,
num supplierId,
num codeTypeId,
String codeValue,
}) =>
SuppTCodes(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
codeTypeId: codeTypeId ?? this.codeTypeId,
codeValue: codeValue ?? this.codeValue,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['codeTypeId'] = codeTypeId;
map['codeValue'] = codeValue;
return map;
}
}
class SuppPersons extends Base {
SuppPersons({
this.id,
this.supplierId,
this.personName,
this.personRoleId,
this.contact,
this.externalEngCode,
this.email,
}) : super(name: personName, identifier: id?.toString());
SuppPersons.fromJson(dynamic json) {
id = json['id'];
identifier = id?.toString();
supplierId = json['supplierId'];
personName = json['personName'];
name = personName;
personRoleId = json['personRoleId'];
contact = json['contact'];
externalEngCode = json['externalEngCode'];
email = json['email'];
}
num id;
num supplierId;
String personName;
num personRoleId;
String contact;
String externalEngCode;
String email;
SuppPersons copyWith({
num id,
num supplierId,
String personName,
num personRoleId,
String contact,
String externalEngCode,
String email,
}) =>
SuppPersons(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
personName: personName ?? this.personName,
personRoleId: personRoleId ?? this.personRoleId,
contact: contact ?? this.contact,
externalEngCode: externalEngCode ?? this.externalEngCode,
email: email ?? this.email,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['personName'] = personName;
map['personRoleId'] = personRoleId;
map['contact'] = contact;
map['externalEngCode'] = externalEngCode;
map['email'] = email;
return map;
}
}
class Attachments {
Attachments({
this.id,
this.supplierId,
this.attachmentName,
this.attachmentURL,
});
Attachments.fromJson(dynamic json) {
id = json['id'];
supplierId = json['supplierId'];
attachmentName = json['attachmentName'];
attachmentURL = json['attachmentURL'];
}
num id;
num supplierId;
String attachmentName;
String attachmentURL;
Attachments copyWith({
num id,
num supplierId,
String attachmentName,
String attachmentURL,
}) =>
Attachments(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
attachmentName: attachmentName ?? this.attachmentName,
attachmentURL: attachmentURL ?? this.attachmentURL,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['attachmentName'] = attachmentName;
map['attachmentURL'] = attachmentURL;
return map;
}
}
class Addresses {
Addresses({
this.id,
this.supplierId,
this.address,
});
Addresses.fromJson(dynamic json) {
id = json['id'];
supplierId = json['supplierId'];
address = json['address'];
}
num id;
num supplierId;
String address;
Addresses copyWith({
num id,
num supplierId,
String address,
}) =>
Addresses(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
address: address ?? this.address,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['address'] = address;
return map;
}
}
class Faxes {
Faxes({
this.id,
this.supplierId,
this.fax,
});
Faxes.fromJson(dynamic json) {
id = json['id'];
supplierId = json['supplierId'];
fax = json['fax'];
}
num id;
num supplierId;
String fax;
Faxes copyWith({
num id,
num supplierId,
String fax,
}) =>
Faxes(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
fax: fax ?? this.fax,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['fax'] = fax;
return map;
}
}
class Telephones {
Telephones({
this.id,
this.supplierId,
this.telephone,
});
Telephones.fromJson(dynamic json) {
id = json['id'];
supplierId = json['supplierId'];
telephone = json['telephone'];
}
num id;
num supplierId;
String telephone;
Telephones copyWith({
num id,
num supplierId,
String telephone,
}) =>
Telephones(
id: id ?? this.id,
supplierId: supplierId ?? this.supplierId,
telephone: telephone ?? this.telephone,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['supplierId'] = supplierId;
map['telephone'] = telephone;
return map;
}
}