codigo actual del servidor, con avances de joan

This commit is contained in:
Jose Sanchez
2023-08-07 15:52:04 -04:00
commit 3cd9b8bbe8
3070 changed files with 532255 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import 'package:active_ecommerce_seller_app/const/dropdown_models.dart';
class AttributesModel {
CommonDropDownItem name;
List<CommonDropDownItem> attributeItems = [];
List<CommonDropDownItem> selectedAttributeItems;
CommonDropDownItem? selectedAttributeItem;
AttributesModel(this.name, this.attributeItems, this.selectedAttributeItems,
this.selectedAttributeItem);
}

View File

@@ -0,0 +1,85 @@
// To parse this JSON data, do
//
// final attributeResponse = attributeResponseFromJson(jsonString);
import 'dart:convert';
AttributeResponse attributeResponseFromJson(String str) => AttributeResponse.fromJson(json.decode(str));
String attributeResponseToJson(AttributeResponse data) => json.encode(data.toJson());
class AttributeResponse {
AttributeResponse({
this.data,
});
List<Attribute>? data;
factory AttributeResponse.fromJson(Map<String, dynamic> json) => AttributeResponse(
data: List<Attribute>.from(json["data"].map((x) => Attribute.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Attribute {
Attribute({
this.id,
this.name,
this.values,
});
var id;
String? name;
List<Value>? values;
factory Attribute.fromJson(Map<String, dynamic> json) => Attribute(
id: json["id"],
name: json["name"],
values: List<Value>.from(json["values"].map((x) => Value.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"values": List<dynamic>.from(values!.map((x) => x.toJson())),
};
}
class Value {
Value({
this.id,
this.attributeId,
this.value,
this.colorCode,
this.createdAt,
this.updatedAt,
});
var id;
var attributeId;
String? value;
dynamic colorCode;
DateTime? createdAt;
DateTime? updatedAt;
factory Value.fromJson(Map<String, dynamic> json) => Value(
id: json["id"],
attributeId: json["attribute_id"],
value: json["value"],
colorCode: json["color_code"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"attribute_id": attributeId,
"value": value,
"color_code": colorCode,
"created_at": createdAt!.toIso8601String(),
"updated_at": updatedAt!.toIso8601String(),
};
}

View File

@@ -0,0 +1,49 @@
// To parse this JSON data, do
//
// final brandResponse = brandResponseFromJson(jsonString);
import 'dart:convert';
BrandResponse brandResponseFromJson(String str) => BrandResponse.fromJson(json.decode(str));
String brandResponseToJson(BrandResponse data) => json.encode(data.toJson());
class BrandResponse {
BrandResponse({
this.data,
});
List<Brand>? data;
factory BrandResponse.fromJson(Map<String, dynamic> json) => BrandResponse(
data: List<Brand>.from(json["data"].map((x) => Brand.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Brand {
Brand({
this.id,
this.name,
this.icon,
});
int? id;
String? name;
String? icon;
factory Brand.fromJson(Map<String, dynamic> json) => Brand(
id: json["id"],
name: json["name"],
icon: json["icon"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"icon": icon,
};
}

View File

@@ -0,0 +1,73 @@
// To parse this JSON data, do
//
// final categoryResponse = categoryResponseFromJson(jsonString);
import 'dart:convert';
CategoryResponse categoryResponseFromJson(String str) => CategoryResponse.fromJson(json.decode(str));
String categoryResponseToJson(CategoryResponse data) => json.encode(data.toJson());
class CategoryResponse {
CategoryResponse({
this.data,
});
List<Category>? data;
factory CategoryResponse.fromJson(Map<String, dynamic> json) => CategoryResponse(
data: List<Category>.from(json["data"].map((x) => Category.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Category {
Category({
this.id,
this.parentId,
this.level,
this.name,
this.banner,
this.icon,
this.featured,
this.digital,
this.child,
});
var id;
var parentId;
var level;
String? name;
String? banner;
String? icon;
bool? featured;
bool? digital;
List<Category>? child;
factory Category.fromJson(Map<String, dynamic> json) => Category(
id: json["id"],
parentId: json["parent_id"],
level: int.parse(json["level"].toString()),
name: json["name"],
banner: json["banner"],
icon: json["icon"],
featured: json["featured"],
digital: json["digital"],
child: List<Category>.from(json["child"].map((x) => Category.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"id": id,
"parent_id": parentId,
"level": level,
"name": name,
"banner": banner,
"icon": icon,
"featured": featured,
"digital": digital,
"child": List<dynamic>.from(child!.map((x) => x.toJson())),
};
}

View File

@@ -0,0 +1,18 @@
class CategoryModel{
String? id ="",parentId="";
String? parentLevel='';
int? level=0;
String? levelText='';
CategoryModel({this.id, this.parentId, this.parentLevel,this.level ,this.levelText});
setLevelText(){
String tmpTxt="";
for(int i =0;i<level!;i++){
tmpTxt+="";
}
levelText="$tmpTxt $levelText";
}
}

View File

@@ -0,0 +1,49 @@
// To parse this JSON data, do
//
// final colorResponse = colorResponseFromJson(jsonString);
import 'dart:convert';
ColorResponse colorResponseFromJson(String str) => ColorResponse.fromJson(json.decode(str));
String colorResponseToJson(ColorResponse data) => json.encode(data.toJson());
class ColorResponse {
ColorResponse({
this.data,
});
List<ColorInfo>? data;
factory ColorResponse.fromJson(Map<String, dynamic> json) => ColorResponse(
data: List<ColorInfo>.from(json["data"].map((x) => ColorInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class ColorInfo {
ColorInfo({
this.id,
this.name,
this.code,
});
int? id;
String? name;
String? code;
factory ColorInfo.fromJson(Map<String, dynamic> json) => ColorInfo(
id: json["id"],
name: json["name"],
code: json["code"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
"code": code,
};
}

View File

@@ -0,0 +1,8 @@
class CustomRadioModel{
String title,key;
bool isActive;
CustomRadioModel(this.title,this.key, this.isActive);
}

View File

@@ -0,0 +1,442 @@
// To parse this JSON data, do
//
// final productEditResponse = productEditResponseFromJson(jsonString);
import 'dart:convert';
import 'package:active_ecommerce_seller_app/data_model/uploaded_file_list_response.dart';
ProductEditResponse productEditResponseFromJson(String str) => ProductEditResponse.fromJson(json.decode(str));
String productEditResponseToJson(ProductEditResponse data) => json.encode(data.toJson());
class ProductEditResponse {
ProductEditResponse({
this.data,
this.result,
this.status,
});
ProductInfo? data;
bool? result;
var status;
factory ProductEditResponse.fromJson(Map<String, dynamic> json) => ProductEditResponse(
data: ProductInfo.fromJson(json["data"]),
result: json["result"],
status: json["status"],
);
Map<String, dynamic> toJson() => {
"data": data!.toJson(),
"result": result,
"status": status,
};
}
class ProductInfo {
ProductInfo({
this.id,
this.lang,
this.productName,
this.productUnit,
this.description,
this.categoryId,
this.brandId,
this.photos,
this.thumbnailImg,
this.videoProvider,
this.videoLink,
this.tags,
this.unitPrice,
this.purchasePrice,
this.variantProduct,
this.attributes,
this.choiceOptions,
this.colors,
this.variations,
this.stocks,
this.todaysDeal,
this.published,
this.approved,
this.stockVisibilityState,
this.cashOnDelivery,
this.featured,
this.sellerFeatured,
this.refundable,
this.currentStock,
this.weight,
this.minQty,
this.lowStockQuantity,
this.discount,
this.discountType,
this.discountStartDate,
this.discountEndDate,
this.tax,
this.taxType,
this.shippingType,
this.shippingCost,
this.isQuantityMultiplied,
this.estShippingDays,
this.numOfSale,
this.metaTitle,
this.metaDescription,
this.metaImg,
this.pdf,
this.slug,
this.rating,
this.barcode,
this.digital,
this.auctionProduct,
this.fileName,
this.filePath,
this.externalLink,
this.externalLinkBtn,
this.wholesaleProduct,
this.createdAt,
this.updatedAt,
});
var id;
String? lang;
String? productName;
String? productUnit;
dynamic description;
var categoryId;
dynamic brandId;
Photos? photos;
Photos? thumbnailImg;
String? videoProvider;
dynamic videoLink;
String? tags;
var unitPrice;
dynamic purchasePrice;
var variantProduct;
List<String>? attributes;
List<ChoiceOption>? choiceOptions;
List<String>? colors;
dynamic variations;
Stock? stocks;
var todaysDeal;
var published;
var approved;
String? stockVisibilityState;
var cashOnDelivery;
var featured;
var sellerFeatured;
var refundable;
var currentStock;
var weight;
var minQty;
var lowStockQuantity;
var discount;
String? discountType;
var discountStartDate;
var discountEndDate;
List<Tax>? tax;
dynamic taxType;
String? shippingType;
var shippingCost;
var isQuantityMultiplied;
dynamic estShippingDays;
var numOfSale;
String? metaTitle;
String? metaDescription;
Photos? metaImg;
Photos? pdf;
String? slug;
var rating;
dynamic barcode;
var digital;
var auctionProduct;
dynamic fileName;
dynamic filePath;
dynamic externalLink;
dynamic externalLinkBtn;
var wholesaleProduct;
DateTime? createdAt;
DateTime? updatedAt;
factory ProductInfo.fromJson(Map<String, dynamic> json) => ProductInfo(
id: json["id"],
lang: json["lang"],
productName: json["product_name"],
productUnit: json["product_unit"],
description: json["description"],
categoryId: json["category_id"],
brandId: json["brand_id"],
photos: Photos.fromJson(json["photos"]),
thumbnailImg: Photos.fromJson(json["thumbnail_img"]),
videoProvider: json["video_provider"],
videoLink: json["video_link"],
tags: json["tags"],
unitPrice: json["unit_price"],
purchasePrice: json["purchase_price"],
variantProduct: json["variant_product"],
attributes: List<String>.from(json["attributes"].map((x) => x)),
choiceOptions: List<ChoiceOption>.from(json["choice_options"].map((x) => ChoiceOption.fromJson(x))),
colors: List<String>.from(json["colors"].map((x) => x)),
variations: json["variations"],
stocks: Stock.fromJson(json["stocks"]),
todaysDeal: json["todays_deal"],
published: json["published"],
approved: json["approved"],
stockVisibilityState: json["stock_visibility_state"],
cashOnDelivery: json["cash_on_delivery"],
featured: json["featured"],
sellerFeatured: json["seller_featured"]??0,
refundable: json["refundable"],
currentStock: json["current_stock"],
weight: json["weight"],
minQty: json["min_qty"],
lowStockQuantity: json["low_stock_quantity"],
discount: json["discount"],
discountType: json["discount_type"],
discountStartDate: json["discount_start_date"],
discountEndDate: json["discount_end_date"],
tax:List<Tax>.from(json["tax"].map((x) => Tax.fromJson(x))),
taxType: json["tax_type"],
shippingType: json["shipping_type"],
shippingCost: json["shipping_cost"],
isQuantityMultiplied: json["is_quantity_multiplied"],
estShippingDays: json["est_shipping_days"],
numOfSale: json["num_of_sale"],
metaTitle: json["meta_title"],
metaDescription: json["meta_description"],
// metaImg: json["meta_img"],
metaImg: Photos.fromJson(json["meta_img"]),
pdf: Photos.fromJson(json["pdf"]),
slug: json["slug"],
rating: json["rating"],
barcode: json["barcode"],
digital: json["digital"],
auctionProduct: json["auction_product"],
fileName: json["file_name"],
filePath: json["file_path"],
externalLink: json["external_link"],
externalLinkBtn: json["external_link_btn"],
wholesaleProduct: json["wholesale_product"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"lang": lang,
"product_name": productName,
"product_unit": productUnit,
"description": description,
"category_id": categoryId,
"brand_id": brandId,
"photos": photos!.toJson(),
"thumbnail_img": thumbnailImg!.toJson(),
"video_provider": videoProvider,
"video_link": videoLink,
"tags": tags,
"unit_price": unitPrice,
"purchase_price": purchasePrice,
"variant_product": variantProduct,
"attributes": List<dynamic>.from(attributes!.map((x) => x)),
"choice_options": List<dynamic>.from(choiceOptions!.map((x) => x.toJson())),
"colors": List<dynamic>.from(colors!.map((x) => x)),
"variations": variations,
"stocks": stocks!.toJson(),
"todays_deal": todaysDeal,
"published": published,
"approved": approved,
"stock_visibility_state": stockVisibilityState,
"cash_on_delivery": cashOnDelivery,
"featured": featured,
"seller_featured": sellerFeatured,
"refundable": refundable,
"current_stock": currentStock,
"weight": weight,
"min_qty": minQty,
"low_stock_quantity": lowStockQuantity,
"discount": discount,
"discount_type": discountType,
"discount_start_date": discountStartDate,
"discount_end_date": discountEndDate,
"tax": List<dynamic>.from(tax!.map((x) => x.toJson())),
"tax_type": taxType,
"shipping_type": shippingType,
"shipping_cost": shippingCost,
"is_quantity_multiplied": isQuantityMultiplied,
"est_shipping_days": estShippingDays,
"num_of_sale": numOfSale,
"meta_title": metaTitle,
"meta_description": metaDescription,
"meta_img": metaImg!.toJson(),
"pdf": pdf!.toJson(),
"slug": slug,
"rating": rating,
"barcode": barcode,
"digital": digital,
"auction_product": auctionProduct,
"file_name": fileName,
"file_path": filePath,
"external_link": externalLink,
"external_link_btn": externalLinkBtn,
"wholesale_product": wholesaleProduct,
"created_at": createdAt!.toIso8601String(),
"updated_at": updatedAt!.toIso8601String(),
};
}
class ChoiceOption {
ChoiceOption({
this.attributeId,
this.values,
});
String? attributeId;
List<String>? values;
factory ChoiceOption.fromJson(Map<String, dynamic> json) => ChoiceOption(
attributeId: json["attribute_id"],
values: List<String>.from(json["values"].map((x) => x)),
);
Map<String, dynamic> toJson() => {
"attribute_id": attributeId,
"values": List<dynamic>.from(values!.map((x) => x)),
};
}
class StockValues {
StockValues({
this.id,
this.fileOriginalName,
this.fileName,
this.url,
this.fileSize,
this.extension,
this.type,
this.productId,
this.variant,
this.sku,
this.price,
this.qty,
this.image,
});
var id;
String? fileOriginalName;
String? fileName;
String? url;
var fileSize;
String? extension;
String? type;
var productId;
String? variant;
String? sku;
var price;
var qty;
Photos? image;
factory StockValues.fromJson(Map<String, dynamic> json) => StockValues(
id: json["id"],
fileOriginalName: json["file_original_name"],
fileName: json["file_name"],
url: json["url"],
fileSize: json["file_size"],
extension: json["extension"],
type: json["type"],
productId: json["product_id"],
variant: json["variant"],
sku: json["sku"],
price: json["price"],
qty: json["qty"],
image: json["image"] == null ? null : Photos.fromJson(json["image"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"file_original_name": fileOriginalName,
"file_name": fileName,
"url": url,
"file_size": fileSize,
"extension": extension,
"type": type,
"product_id": productId,
"variant": variant,
"sku": sku,
"price": price,
"qty": qty,
"image": image!.toJson(),
};
}
class Photos {
Photos({
this.data,
});
List<FileInfo>? data;
factory Photos.fromJson(Map<String, dynamic> json) => Photos(
data: List<FileInfo>.from(json["data"].map((x) => FileInfo.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Stock {
Stock({
this.data,
});
List<StockValues>? data;
factory Stock.fromJson(Map<String, dynamic> json) => Stock(
data: List<StockValues>.from(json["data"].map((x) => StockValues.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Tax {
Tax({
this.id,
this.productId,
this.taxId,
this.tax,
this.taxType,
this.createdAt,
this.updatedAt,
});
var id;
var productId;
var taxId;
var tax;
String? taxType;
DateTime? createdAt;
DateTime? updatedAt;
factory Tax.fromJson(Map<String, dynamic> json) => Tax(
id: json["id"],
productId: json["product_id"],
taxId: json["tax_id"],
tax: json["tax"],
taxType: json["tax_type"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"product_id": productId,
"tax_id": taxId,
"tax": tax,
"tax_type": taxType,
"created_at": createdAt!.toIso8601String(),
"updated_at": updatedAt!.toIso8601String(),
};
}

View File

@@ -0,0 +1,45 @@
// To parse this JSON data, do
//
// final taxResponse = taxResponseFromJson(jsonString);
import 'dart:convert';
TaxResponse taxResponseFromJson(String str) => TaxResponse.fromJson(json.decode(str));
String taxResponseToJson(TaxResponse data) => json.encode(data.toJson());
class TaxResponse {
TaxResponse({
this.data,
});
List<Datum>? data;
factory TaxResponse.fromJson(Map<String, dynamic> json) => TaxResponse(
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Datum {
Datum({
this.id,
this.name,
});
int? id;
String? name;
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"],
name: json["name"],
);
Map<String, dynamic> toJson() => {
"id": id,
"name": name,
};
}

View File

@@ -0,0 +1,18 @@
import 'package:active_ecommerce_seller_app/const/dropdown_models.dart';
import 'package:flutter/material.dart';
class VatTaxModel{
String id ,name;
VatTaxModel(this.id, this.name);
}
class VatTaxViewModel{
VatTaxModel vatTaxModel;
TextEditingController amount= TextEditingController(text: "0");
List<CommonDropDownItem> items;
CommonDropDownItem? selectedItem;
VatTaxViewModel(this.vatTaxModel, this.items,{CommonDropDownItem? selectedItem,String? amount}) {
this.selectedItem= selectedItem ?? items.first;
this.amount.text=amount??"0";
}
}