Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions src/app/pages/product-orders/product-orders.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {
showOrderDetails:boolean=false;
orderToShow:any;
dateRange = new FormControl();
selectedDate:any;
countries: any[] = countries;
preferred:boolean=false;
loading_more: boolean = false;
Expand Down Expand Up @@ -90,10 +89,6 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {

ngOnInit() {
this.loading=true;
let today = new Date();
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
this.dateRange.setValue('month');

let order_button = document.getElementById('order-button')
let invoices_button = document.getElementById('bill-button')
Expand Down Expand Up @@ -159,7 +154,6 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {
let options = {
"filters": this.filters,
"partyId": this.partyId,
"selectedDate": this.selectedDate,
"orders": this.orders,
"role": this.role
}
Expand Down Expand Up @@ -205,29 +199,6 @@ export class ProductOrdersComponent implements OnInit, OnDestroy {
}
}

filterOrdersByDate(){
if(this.dateRange.value == 'month'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
} else if (this.dateRange.value == 'months'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-3);
this.selectedDate = today.toISOString();
} else if(this.dateRange.value == 'year'){
let today = new Date();
today.setDate(1);
today.setMonth(0);
today.setFullYear(today.getFullYear()-1);
this.selectedDate = today.toISOString();
} else {
this.selectedDate = undefined
}
this.getOrders(false);
}

getTotalPrice(items:any[]){
let totalPrice = [];
let insertCheck = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class OrderInfoComponent implements OnInit, AfterViewInit, OnDestroy {
showOrderDetails:boolean=false;
orderToShow:any;
dateRange = new FormControl();
selectedDate:any;
countries: any[] = countries;
preferred:boolean=false;
loading_more: boolean = false;
Expand Down Expand Up @@ -205,10 +204,6 @@ export class OrderInfoComponent implements OnInit, AfterViewInit, OnDestroy {

ngOnInit() {
this.loading = true;
let today = new Date();
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
this.dateRange.setValue('month');
this.initPartyInfo();
}

Expand Down Expand Up @@ -320,7 +315,6 @@ export class OrderInfoComponent implements OnInit, AfterViewInit, OnDestroy {
let options = {
"filters": this.filters,
"partyId": this.partyId,
"selectedDate": this.selectedDate,
"orders": this.orders,
"role": this.role
}
Expand Down Expand Up @@ -378,29 +372,6 @@ export class OrderInfoComponent implements OnInit, AfterViewInit, OnDestroy {
}
}

filterOrdersByDate(){
if(this.dateRange.value == 'month'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
} else if (this.dateRange.value == 'months'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-3);
this.selectedDate = today.toISOString();
} else if(this.dateRange.value == 'year'){
let today = new Date();
today.setDate(1);
today.setMonth(0);
today.setFullYear(today.getFullYear()-1);
this.selectedDate = today.toISOString();
} else {
this.selectedDate = undefined
}
this.getOrders(false);
}

getTotalPrice(items:any[]){
let totalPrice = [];
let insertCheck = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export class OrderInfoComponent implements OnInit, OnDestroy {
showOrderDetails:boolean=false;
orderToShow:any;
dateRange = new FormControl();
selectedDate:any;
countries: any[] = countries;
preferred:boolean=false;
loading_more: boolean = false;
Expand Down Expand Up @@ -81,10 +80,6 @@ export class OrderInfoComponent implements OnInit, OnDestroy {

ngOnInit() {
this.loading=true;
let today = new Date();
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
this.dateRange.setValue('month');
this.initPartyInfo();
}

Expand Down Expand Up @@ -143,7 +138,6 @@ export class OrderInfoComponent implements OnInit, OnDestroy {
let options = {
"filters": this.filters,
"partyId": this.partyId,
"selectedDate": this.selectedDate,
"orders": this.orders,
"role": this.role
}
Expand Down Expand Up @@ -189,29 +183,6 @@ export class OrderInfoComponent implements OnInit, OnDestroy {
}
}

filterOrdersByDate(){
if(this.dateRange.value == 'month'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-1);
this.selectedDate = today.toISOString();
} else if (this.dateRange.value == 'months'){
let today = new Date();
today.setDate(1);
today.setMonth(today.getMonth()-3);
this.selectedDate = today.toISOString();
} else if(this.dateRange.value == 'year'){
let today = new Date();
today.setDate(1);
today.setMonth(0);
today.setFullYear(today.getFullYear()-1);
this.selectedDate = today.toISOString();
} else {
this.selectedDate = undefined
}
this.getOrders(false);
}

getTotalPrice(items:any[]){
let totalPrice = [];
let insertCheck = false;
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/pagination.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,10 @@ export class PaginationService {
}
}*/

async getOrders(page: number, filters: Category[], partyId: any, selectedDate: any, orders: any[], role: any): Promise<any[]> {
async getOrders(page: number, filters: Category[], partyId: any, orders: any[], role: any): Promise<any[]> {
try {
// Get Orders
orders = await this.orderService.getProductOrders(partyId, page, filters, selectedDate, role);
orders = await this.orderService.getProductOrders(partyId, page, filters, role);
console.log('getOrders', orders);
// Obtener todas las cuentas de facturación en paralelo
const billingAccounts = await Promise.all(orders.map(order => this.accountService.getBillingAccountById(order.billingAccount.id)));
Expand Down
5 changes: 1 addition & 4 deletions src/app/services/product-order-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ProductOrderService {
return this.http.post<any>(url, prod, { observe: 'response' });
}

getProductOrders(partyId:any,page:any,filters:any[],date:any,role:any){
getProductOrders(partyId:any,page:any,filters:any[],role:any){
console.log('getProductOrders');
let url = `${ProductOrderService.BASE_URL}${ProductOrderService.API_ORDERING}/productOrder?limit=${ProductOrderService.ORDER_LIMIT}&offset=${page}&relatedParty.id=${partyId}&relatedParty.role=${role}`;

Expand All @@ -40,9 +40,6 @@ export class ProductOrderService {
}
url=url+'&state='+status;
}
if(date!=undefined){
url=url+'&orderDate>'+date;
}
return lastValueFrom(this.http.get<any[]>(url));
}

Expand Down
Loading