fix bugs and correct models

This commit is contained in:
PawelJa 2019-01-11 22:22:08 +01:00
parent ccc22607eb
commit 1b7ff43178
19 changed files with 190 additions and 91 deletions

View File

@ -3,20 +3,23 @@
<component name="ChangeListManager">
<list default="true" id="baac0fea-ba77-4412-8e4a-c4ee1e16e324" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/alghoritms.go" beforeDir="false" afterPath="$PROJECT_DIR$/alghoritms.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/calendarController.go" beforeDir="false" afterPath="$PROJECT_DIR$/calendarController.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/models.go" beforeDir="false" afterPath="$PROJECT_DIR$/models.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/queriesController.go" beforeDir="false" afterPath="$PROJECT_DIR$/queriesController.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/angular.json" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/angular.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/app.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/app.module.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/app.router.module.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/app.router.module.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/admin-menu/admin-menu.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/admin-menu/admin-menu.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/login/login.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/login/login.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/query-detailes/query-detailes.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/nav-bar/nav-bar.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/nav-bar/nav-bar.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/queries-list-admin/queries-list-admin.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list/term-list.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/models/Query.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/models/Query.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/services/query.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/services/query.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.prod.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.prod.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/szt_visio.exe" beforeDir="false" afterPath="$PROJECT_DIR$/szt_visio.exe" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -74,22 +77,22 @@
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="go" value="9583" />
<entry key="go" value="9672" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="Go" value="9583" />
<entry key="Go" value="9672" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="go" value="42" />
<entry key="go" value="45" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="Go" value="42" />
<entry key="Go" value="45" />
</counts>
</usages-collector>
<usages-collector id="statistics.go.postfix.template.usages.trigger">
@ -104,8 +107,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="320">
<caret line="28" column="58" selection-start-line="28" selection-start-column="58" selection-end-line="28" selection-end-column="58" />
<state relative-caret-position="337">
<caret line="29" column="29" selection-start-line="29" selection-start-column="29" selection-end-line="29" selection-end-column="29" />
<folding>
<element signature="e#14#128#0" expanded="true" />
</folding>
@ -114,28 +117,19 @@
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/queriesController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="65" column="29" selection-start-line="65" selection-start-column="29" selection-end-line="65" selection-end-column="29" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/calendarController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="524">
<caret line="133" column="1" selection-start-line="92" selection-end-line="133" selection-end-column="1" />
<state relative-caret-position="323">
<caret line="38" column="96" selection-start-line="38" selection-start-column="96" selection-end-line="38" selection-end-column="96" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/models.go">
<entry file="file://$PROJECT_DIR$/queriesController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="8" column="22" selection-start-line="8" selection-start-column="22" selection-end-line="8" selection-end-column="22" />
<state relative-caret-position="714">
<caret line="48" column="5" selection-start-line="48" selection-start-column="5" selection-end-line="48" selection-end-column="5" />
</state>
</provider>
</entry>
@ -174,10 +168,10 @@
<option value="$PROJECT_DIR$/routes.go" />
<option value="$PROJECT_DIR$/router.go" />
<option value="$PROJECT_DIR$/alghoritms.go" />
<option value="$PROJECT_DIR$/calendarController.go" />
<option value="$PROJECT_DIR$/main.go" />
<option value="$PROJECT_DIR$/models.go" />
<option value="$PROJECT_DIR$/main.go" />
<option value="$PROJECT_DIR$/queriesController.go" />
<option value="$PROJECT_DIR$/calendarController.go" />
</list>
</option>
</component>
@ -274,7 +268,8 @@
</recent_temporary>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="7" />
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.29637527" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
@ -357,21 +352,14 @@
</entry>
<entry file="file://$PROJECT_DIR$/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="320">
<caret line="28" column="58" selection-start-line="28" selection-start-column="58" selection-end-line="28" selection-end-column="58" />
<state relative-caret-position="337">
<caret line="29" column="29" selection-start-line="29" selection-start-column="29" selection-end-line="29" selection-end-column="29" />
<folding>
<element signature="e#14#128#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/calendarController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="524">
<caret line="133" column="1" selection-start-line="92" selection-end-line="133" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/models.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
@ -381,8 +369,15 @@
</entry>
<entry file="file://$PROJECT_DIR$/queriesController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="493">
<caret line="65" column="29" selection-start-line="65" selection-start-column="29" selection-end-line="65" selection-end-column="29" />
<state relative-caret-position="714">
<caret line="48" column="5" selection-start-line="48" selection-start-column="5" selection-end-line="48" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/calendarController.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="38" column="96" selection-start-line="38" selection-start-column="96" selection-end-line="38" selection-end-column="96" />
</state>
</provider>
</entry>

View File

@ -36,7 +36,7 @@ func addRow(data string, w http.ResponseWriter) {
return
}
defer tx.Rollback()
stmt, err := tx.Prepare("INSERT INTO calendar (date, status, contractNo) VALUES ( $1, 'available', '');")
stmt, err := tx.Prepare("INSERT INTO calendar (date, status, contractNo) VALUES ( $1, 'wolny', '');")
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return

View File

@ -27,6 +27,7 @@ func main() {
router.HandleFunc("/query", newQuery).Methods("POST", "OPTIONS")
router.HandleFunc("/query", getQueryList).Methods("GET", "OPTIONS")
router.HandleFunc("/query", updateQuery).Methods("PUT", "OPTIONS")
router.HandleFunc("/test", postTest).Methods("POST", "OPTIONS")

View File

@ -11,36 +11,43 @@ import (
func newQuery(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
panic(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
log.Println(string(body))
var query Query
err = json.Unmarshal(body, &query)
if err != nil {
panic(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
tx, err := db.Begin()
if err != nil {
log.Fatal(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
defer tx.Rollback()
stmt, err := tx.Prepare("INSERT INTO queries (startdate, enddate, location, description, contactperson, contactno, email, status, questiondate) VALUES" +
"( $1, $2, $3, $4, $5, $6, $7, $8, $9);")
if err != nil {
log.Fatal(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
defer stmt.Close() // danger!
for i := 0; i < 1; i++ {
_, err = stmt.Exec(query.Startdate, query.Enddate, query.Location, query.Description, query.Contactperson, query.Contactno, query.Email, query.Status, query.Questiondate)
if err != nil {
log.Fatal(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
}
err = tx.Commit()
if err != nil {
log.Fatal(err)
http.Error(w, "błąd zapisu danych", 500)
return
}
return
}
func getQueryList(w http.ResponseWriter, r *http.Request) {
@ -90,4 +97,52 @@ func getQueryList(w http.ResponseWriter, r *http.Request) {
}
fmt.Fprint(w, string(out))
}
func updateQuery(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
log.Println(string(body))
var query Query
err = json.Unmarshal(body, &query)
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
fmt.Println(query)
{
tx, err := db.Begin()
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
defer tx.Rollback()
stmt, err := tx.Prepare("UPDATE queries SET status=$1 WHERE id=$2;")
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
defer stmt.Close()
for i := 0; i < 1; i++ {
_, err = stmt.Exec(query.Status, query.Id )
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
}
err = tx.Commit()
if err != nil {
http.Error(w, "błąd zapisu danych", 500)
return
}
}
return
}

View File

@ -69,3 +69,4 @@ registerLocaleData(pl);
})
export class AppModule {
}
//

View File

@ -64,13 +64,9 @@ export class CreateQueryComponent {
this.dialogRef.close();
}
onSubmit() {
const startdate = new Date(this.form.controls.startdate.value);
this.newQuery.startdate = startdate.getFullYear() + '-' + startdate.getMonth() + 1 + '-' + startdate.getDay();
const enddate = new Date(this.form.controls.enddate.value);
this.newQuery.enddate = enddate.getFullYear() + '-' + enddate.getMonth() + 1 + '-' + enddate.getDay();
async onSubmit() {
this.newQuery.startdate = this.form.controls.startdate.value;
this.newQuery.enddate = this.form.controls.enddate.value;
this.newQuery.location = this.form.controls.location.value;
this.newQuery.description = this.form.controls.description.value;
this.newQuery.contactperson = this.form.controls.contactperson.value;
@ -78,8 +74,9 @@ export class CreateQueryComponent {
this.newQuery.email = this.form.controls.email.value;
console.log('wysylam ', this.newQuery);
this.queryService.createQuery(this.newQuery).subscribe(x => {
this.openSnackBar('Rezerwacja wysłana !');
await this.queryService.createQuery(this.newQuery).subscribe(
x => {
this.openSnackBar('Zapisano zmiany !');
this.onAbort();
},
error => this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie'));
@ -91,4 +88,3 @@ export class CreateQueryComponent {
});
}
}

View File

@ -33,10 +33,7 @@ export class EditTermAdminComponent implements OnInit {
onSubmit() {
const term = new Term();
const dateTemp = new Date(this.form.controls.date.value);
// const year = String(dateTemp.getFullYear());
// @ts-ignore
term.date = String(dateTemp.getFullYear() + '-' + dateTemp.getMonth() + 1 + '-' + dateTemp.getDay());
term.date = this.form.controls.date.value;
term.status = this.form.controls.status.value;
term.contractno = this.form.controls.contractno.value;
console.log(term);

View File

@ -45,7 +45,7 @@
Lokalizacja
</div>
<div class="col-sm-9">
{{ data.questiondate | date: 'dd - MM - yyyy' }}
{{ data.location }}
</div>
<div class="col-sm-3">
@ -55,5 +55,7 @@
{{ data.description }}
</div>
</div>
<button class="btn btn-sm btn-info" (click)="onNoClick()">Zamknij</button>
<button class="btn btn-sm btn-info" (click)="setAsRead()">Zamknij</button>
<button class="btn btn-sm btn-info" (click)="setAsUnread()">Oznacz jako nieprzeczytane</button>
<button class="btn btn-sm btn-info" (click)="setAsOfferSend()">Oznacz, że wysłano ofertę</button>
</div>

View File

@ -1,7 +1,8 @@
import {Component, Inject, OnInit} from '@angular/core';
import {Query} from '../../../models/Query';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
import {MAT_DIALOG_DATA, MatDialogRef, MatSnackBar} from '@angular/material';
import {FormGroup} from '@angular/forms';
import {QueryService} from '../../../services/query.service';
@Component({
selector: 'app-query-detailes',
@ -10,14 +11,53 @@ import {FormGroup} from '@angular/forms';
})
export class QueryDetailesComponent implements OnInit {
constructor(public dialogRef: MatDialogRef<QueryDetailesComponent>, @Inject(MAT_DIALOG_DATA) public data: Query) {
constructor(public dialogRef: MatDialogRef<QueryDetailesComponent>, @Inject(MAT_DIALOG_DATA) public data: Query, private queryService: QueryService, public snackBar: MatSnackBar) {
}
ngOnInit() {
}
onNoClick(): void {
closeDialog(): void {
this.dialogRef.close();
}
async setAsUnread() {
this.data.status = 1;
await this.queryService.updateQuery(this.data).subscribe(
x => {
this.openSnackBar('Zapisano zmiany !');
this.closeDialog();
},
error => this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie'));
this.closeDialog();
}
async setAsRead() {
this.data.status = 2;
await this.queryService.updateQuery(this.data).subscribe(
x => {
this.openSnackBar('Zapisano zmiany !');
this.closeDialog();
},
error => this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie'));
this.closeDialog();
}
async setAsOfferSend() {
console.log(new Date());
this.data.status = 3;
await this.queryService.updateQuery(this.data).subscribe(
x => {
this.openSnackBar('Zapisano zmiany !');
this.closeDialog();
},
error => this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie'));
this.closeDialog();
}
openSnackBar(message: string) {
this.snackBar.open(message, null, {
duration: 2500,
});
}
}

View File

@ -1,6 +1,5 @@
<nav class="navbar navbar-dark bg-dark">
<a routerLink="/list-term">Terminarz</a>
<a routerLink="/test">Add term2</a>
<button class="btn btn-light" routerLink="/list-term">Terminarz</button>
<form class="form-inline">
<div *ngIf="authService.user" style="margin-right: 10px">
<button (click)="logout()" type="button" class="btn btn-sm btn-info">Wyloguj</button>

View File

@ -18,10 +18,10 @@
<td>{{ query.location }}</td>
<td>{{query.startdate | date: 'dd - MM - yyyy' }}</td>
<td>{{query.enddate | date: 'dd - MM - yyyy' }}</td>
<td><span *ngIf="query.status === 1"><strong>NOWE</strong></span><span *ngIf="query.status === 2">PRZECZYTANE</span></td>
<td>{{query.contactperson }}</td>
<td><span *ngIf="query.status === 1"><strong>Nowe</strong></span><span *ngIf="query.status === 2">Przeczytanie</span><span *ngIf="query.status === 3">Wysłano ofertę</span></td>
<td>
<button type="button" class="btn btn-success" (click)="showDetails(query)">Szczegóły</button>
<button type="button" class="btn btn-info" (click)="showDetails(query)">Szczegóły</button>
</td>
</tr>
</tbody>

View File

@ -33,7 +33,7 @@ export class QueriesListAdminComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.queryService.getQueryList();
});
}
}

View File

@ -46,17 +46,18 @@ export class TermListAdminComponent implements OnInit {
this.openDialog(event);
}
deleteTerm(event: Term) {
async deleteTerm(event: Term) {
event.date = event.date;
event.status = 'wolny';
event.contractno = '';
this.termAdminService.deleteTerm(event).subscribe(
await this.termAdminService.deleteTerm(event).subscribe(
x => {
this.openSnackBar('Zwolniono termin !');
},
error => {
this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie');
});
this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
}
openDialog(term: Term): void {
@ -66,7 +67,7 @@ export class TermListAdminComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
});
}

View File

@ -23,7 +23,9 @@
</div>
<br>
<div style="margin: 0 auto; width: 80%">
<div *ngIf="!searchedProperty" class="alert alert-info">
Proszę wybrać termin
</div>
<table class="table">
<thead class="thead-dark">
<tr>
@ -44,5 +46,7 @@
</tr>
</tbody>
</table>
<div *ngIf="(allTerms$ | async)?.length < 1 && searchedProperty" class="alert alert-danger">
Brak dostępnych terminów.
</div>
</div>

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {Month} from '../../models/Month';
import {DataSources} from '../environments/DataSources';
@ -37,15 +37,13 @@ export class TermListComponent implements OnInit {
form: FormGroup;
yearsList = [];
monthsList: Month[];
searchedProperty = false;
displayedColumns: string[] = ['weekDay', 'date', 'availability'];
dataSource = ELEMENT_DATA;
allTerms$: Observable<Array<Term>>;
animal: string;
name: string;
constructor(private termService: TermService, private dialog: MatDialog) {
this.yearsList = DataSources.yearsList;
this.monthsList = DataSources.monthsList;
@ -60,24 +58,20 @@ export class TermListComponent implements OnInit {
this.allTerms$ = this.termService.terms$;
}
search() {
async search() {
console.log(this.form.value);
this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
await this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
this.searchedProperty = true;
}
openDialog(): void {
const dialogRef = this.dialog.open(CreateQueryComponent, {
width: '65%',
data: {name: this.name, animal: this.animal}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
this.animal = result;
});
}
}
//
// export interface DialogData {
// animal: string;

View File

@ -1,4 +1,5 @@
export class Query {
id: number;
startdate: string;
enddate: string;
location: string;
@ -10,6 +11,7 @@ export class Query {
questiondate: string
constructor() {
this.id = null;
this.startdate = '';
this.enddate = '';
this.location = '';
@ -18,6 +20,6 @@ export class Query {
this.contactno = '';
this.email = '';
this.status = 1;
this.questiondate = new Date().getFullYear() + '-' + new Date().getMonth() + 1 + '-' + new Date().getDay();
this.questiondate = new Date().toISOString();
}
}

View File

@ -21,6 +21,7 @@ export class QueryService {
constructor(private httpClient: HttpClient) { }
createQuery(query: Query) {
console.log('post', query);
return this.httpClient.post(environment.API_BACK + 'query', query, httpOptions);
}
@ -35,4 +36,14 @@ export class QueryService {
console.log(err);
});
}
updateQuery(query: Query) {
const headers = new HttpHeaders();
headers.set('Content-Type', 'application/json; charset=utf-8');
headers.set('Access-Control-Allow-Origin', '*');
headers.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
// @ts-ignore
return this.httpClient.put<Query>(environment.API_BACK + 'query', query, headers);
}
}

View File

@ -1,3 +1,4 @@
export const environment = {
API_BACK: 'http://localhost:8080/',
production: true
};

Binary file not shown.