Add dataenddate
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-06-25 09:47:53 +02:00
parent 277dc7051e
commit b0ff54d157
3 changed files with 83 additions and 76 deletions

View File

@ -1,20 +1,25 @@
.custom-day { .custom-day {
text-align: center; text-align: center;
padding: 0.185rem 0.25rem; padding: 0.185rem 0.25rem;
display: inline-block; display: inline-block;
height: 2rem; height: 2rem;
width: 2rem; width: 2rem;
} }
.custom-day.focused { .custom-day.focused {
background-color: #e6e6e6; background-color: #e6e6e6;
} }
.custom-day.range, .custom-day:hover { .custom-day.range, .custom-day:hover {
background-color: rgb(2, 117, 216); background-color: rgb(2, 117, 216);
color: white; color: white;
} }
.custom-day.faded { .custom-day.faded {
background-color: rgba(2, 117, 216, 0.5); background-color: rgba(2, 117, 216, 0.5);
} }
ngb-datepicker {
overflow: hidden;
max-width: calc(100vw - 3em);
}

View File

@ -18,6 +18,7 @@ export class Item implements IItem {
public created?: Date; public created?: Date;
public updated?: Date; public updated?: Date;
public dataDate?: Date; public dataDate?: Date;
public dataEndDate?: Date;
public itemType?: string; public itemType?: string;
public sourceTask?: string; public sourceTask?: string;
public size?: number; public size?: number;

View File

@ -1,56 +1,57 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable , Observer } from 'rxjs'; import { Observable , Observer } from 'rxjs';
import {map} from 'rxjs/operators'; import {map} from 'rxjs/operators';
import { IListItem } from '../models/list.item'; import { IListItem } from '../models/list.item';
import { IItem } from '../models/item'; import { IItem } from '../models/item';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { AppConfig } from "../shared/app.config"; import { AppConfig } from "../shared/app.config";
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class FolderService { export class FolderService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) { constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
} }
ApiEndpoint() { ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint"); return this.appConfig.getConfig("apiEndPoint");
} }
parseDates(item: any): IListItem { parseDates(item: any): IListItem {
item.created = new Date(Date.parse(item.created)); item.created = new Date(Date.parse(item.created));
item.updated = new Date(Date.parse(item.updated)); item.updated = new Date(Date.parse(item.updated));
item.dataDate = new Date(Date.parse(item.dataDate)); item.dataDate = new Date(Date.parse(item.dataDate));
return item; item.dataEndDate = new Date(Date.parse(item.dataEndDate));
} return item;
}
getFolder(code: string): Observable<IListItem> {
return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`).pipe(map(i => this.parseDates(i))); getFolder(code: string): Observable<IListItem> {
} return this.httpClient.get<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/${code}`).pipe(map(i => this.parseDates(i)));
}
getMyRoots(): Observable<IListItem[]> {
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`).pipe(map(ia => ia.map(i => this.parseDates(i)))); getMyRoots(): Observable<IListItem[]> {
} return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/my_roots`).pipe(map(ia => ia.map(i => this.parseDates(i))));
}
getFolderParents(code: string): Observable<IListItem[]> {
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`).pipe(map(ia => ia.map(i => this.parseDates(i)))); getFolderParents(code: string): Observable<IListItem[]> {
} return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/parents`).pipe(map(ia => ia.map(i => this.parseDates(i))));
}
getChildFolders(code: string): Observable<IListItem[]> {
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`).pipe(map(ia => ia.map(i => this.parseDates(i)))); getChildFolders(code: string): Observable<IListItem[]> {
} return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/listfolders`).pipe(map(ia => ia.map(i => this.parseDates(i))));
}
getItems(code: string,skip:number, take:number): Observable<IListItem[]> {
return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/list?skip=${skip}&take=${take}`).pipe(map(ia => ia.map(i => this.parseDates(i)))); getItems(code: string,skip:number, take:number): Observable<IListItem[]> {
} return this.httpClient.get<IListItem[]>(`${this.ApiEndpoint()}/api/v1/folders/${code}/list?skip=${skip}&take=${take}`).pipe(map(ia => ia.map(i => this.parseDates(i))));
}
moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
const body = { itemCode: itemCode,newParentCode: newParentCode }; moveItem(itemCode: string, newParentCode: string): Observable<IListItem> {
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/items/move`, body).pipe(map(i => this.parseDates(i))); const body = { itemCode: itemCode,newParentCode: newParentCode };
} return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/items/move`, body).pipe(map(i => this.parseDates(i)));
}
createFolder(folder: IItem): Observable<IListItem> {
return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/`, folder).pipe(map(i => this.parseDates(i))); createFolder(folder: IItem): Observable<IListItem> {
} return this.httpClient.post<IListItem>(`${this.ApiEndpoint()}/api/v1/folders/`, folder).pipe(map(i => this.parseDates(i)));
} }
}