admin panel, cors
This commit is contained in:
parent
76914dcfd3
commit
a83ee5e9bc
@ -2,26 +2,32 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="baac0fea-ba77-4412-8e4a-c4ee1e16e324" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/booking.go" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/calendarController.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/calendar/controller.go" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/dbConfig/config.go" beforeDir="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$/router/router.go" beforeDir="false" afterPath="$PROJECT_DIR$/router.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/router/routes.go" beforeDir="false" afterPath="$PROJECT_DIR$/routes.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/models.go" beforeDir="false" afterPath="$PROJECT_DIR$/models.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/router.go" beforeDir="false" afterPath="$PROJECT_DIR$/router.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/routes.go" beforeDir="false" afterPath="$PROJECT_DIR$/routes.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.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/app.component.html" 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/add-terms/add-terms.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/add-terms/add-terms.component.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/create-query/create-query.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/edit-term-admin/edit-term-admin.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/edit-term-admin/edit-term-admin.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/edit-term-admin/edit-term-admin.component.spec.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/dialogs/edit-term-admin/edit-term-admin.component.spec.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/components/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/term-list-admin/term-list-admin.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/term-list-admin/term-list-admin.component.html" 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/components/test/test.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/components/test/test.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/models/CreateQuery.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/models/Term.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/models/Term.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/services/term.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/services/term.service.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/environments/environment.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/styles.css" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/styles.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt-visio-app/src/app/services/termin-admin-service.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/szt-visio-app/src/app/services/termin-admin-service.service.ts" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/szt_visio.exe" beforeDir="false" afterPath="$PROJECT_DIR$/szt_visio.exe" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/test/controller.go" beforeDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -63,33 +69,35 @@
|
||||
<session id="2110107836">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="9" />
|
||||
<entry key="project.closed" value="11" />
|
||||
<entry key="project.open.time.1" value="1" />
|
||||
<entry key="project.open.time.10" value="4" />
|
||||
<entry key="project.open.time.12" value="1" />
|
||||
<entry key="project.open.time.13" value="1" />
|
||||
<entry key="project.open.time.14" value="1" />
|
||||
<entry key="project.open.time.7" value="1" />
|
||||
<entry key="project.open.time.9" value="2" />
|
||||
<entry key="project.opened" value="9" />
|
||||
<entry key="project.opened" value="11" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="go" value="8964" />
|
||||
<entry key="go" value="9258" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Go" value="8964" />
|
||||
<entry key="Go" value="9258" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="go" value="35" />
|
||||
<entry key="go" value="38" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="Go" value="35" />
|
||||
<entry key="Go" value="38" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.go.postfix.template.usages.trigger">
|
||||
@ -101,18 +109,27 @@
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<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="238">
|
||||
<caret line="14" column="88" selection-start-line="14" selection-start-column="88" selection-end-line="14" selection-end-column="88" />
|
||||
<caret line="14" column="95" selection-start-line="14" selection-start-column="95" selection-end-line="14" selection-end-column="95" />
|
||||
<folding>
|
||||
<element signature="e#14#71#0" expanded="true" />
|
||||
<element signature="e#14#128#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/router.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" selection-start-line="2" selection-start-column="2" selection-end-line="18" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/dbConnector.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
@ -125,17 +142,35 @@
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/routes.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="15" column="20" selection-start-line="15" selection-start-column="20" selection-end-line="15" selection-end-column="20" />
|
||||
<state relative-caret-position="391">
|
||||
<caret line="23" column="3" selection-start-line="23" selection-start-column="3" selection-end-line="23" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/calendarController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="252">
|
||||
<caret line="224" column="70" selection-start-line="224" selection-start-column="70" selection-end-line="224" selection-end-column="70" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/calendarController.go">
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2244">
|
||||
<caret line="139" column="48" selection-start-line="139" selection-start-column="48" selection-end-line="139" selection-end-column="48" />
|
||||
<state relative-caret-position="473">
|
||||
<caret line="150" column="1" selection-start-line="79" selection-end-line="150" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="357">
|
||||
<caret line="26" column="68" selection-start-line="26" selection-start-column="68" selection-end-line="26" selection-end-column="68" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -143,8 +178,8 @@
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/models.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="473">
|
||||
<caret line="31" column="1" selection-start-line="31" selection-start-column="1" selection-end-line="31" selection-end-column="1" />
|
||||
<state relative-caret-position="204">
|
||||
<caret line="12" column="43" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@ -172,7 +207,6 @@
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/controller.go" />
|
||||
<option value="$PROJECT_DIR$/logger.go" />
|
||||
<option value="$PROJECT_DIR$/router.go" />
|
||||
<option value="$PROJECT_DIR$/router/router.go" />
|
||||
<option value="$PROJECT_DIR$/calendar/controller.go" />
|
||||
<option value="$PROJECT_DIR$/test/controller.go" />
|
||||
@ -182,11 +216,12 @@
|
||||
<option value="$PROJECT_DIR$/alghoritms.go" />
|
||||
<option value="$PROJECT_DIR$/proba.go" />
|
||||
<option value="$PROJECT_DIR$/queriesController.go" />
|
||||
<option value="$PROJECT_DIR$/models.go" />
|
||||
<option value="$PROJECT_DIR$/booking.go" />
|
||||
<option value="$PROJECT_DIR$/routes.go" />
|
||||
<option value="$PROJECT_DIR$/calendarController.go" />
|
||||
<option value="$PROJECT_DIR$/router.go" />
|
||||
<option value="$PROJECT_DIR$/models.go" />
|
||||
<option value="$PROJECT_DIR$/main.go" />
|
||||
<option value="$PROJECT_DIR$/calendarController.go" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@ -285,7 +320,7 @@
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.2835821" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.28997868" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
@ -320,13 +355,6 @@
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/dbConfig/config.go" />
|
||||
<entry file="file://$PROJECT_DIR$/router.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" selection-start-line="2" selection-end-line="2" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/calendar/controller.go" />
|
||||
<entry file="file://$PROJECT_DIR$/test/controller.go" />
|
||||
<entry file="file://$PROJECT_DIR$/proba.go">
|
||||
@ -336,13 +364,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="357">
|
||||
<caret line="26" column="68" selection-start-line="26" selection-start-column="68" selection-end-line="26" selection-end-column="68" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/alghoritms.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
@ -350,20 +371,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/models.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="473">
|
||||
<caret line="31" column="1" selection-start-line="31" selection-start-column="1" selection-end-line="31" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-666">
|
||||
<caret line="87" column="29" selection-start-line="87" selection-start-column="29" selection-end-line="87" selection-end-column="29" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/dbConnector.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="357">
|
||||
@ -371,29 +378,57 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/routes.go">
|
||||
<entry file="file://$PROJECT_DIR$/queriesController.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="15" column="20" selection-start-line="15" selection-start-column="20" selection-end-line="15" selection-end-column="20" />
|
||||
<state relative-caret-position="357">
|
||||
<caret line="26" column="68" selection-start-line="26" selection-start-column="68" selection-end-line="26" selection-end-column="68" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/calendarController.go">
|
||||
<entry file="file://$PROJECT_DIR$/models.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2244">
|
||||
<caret line="139" column="48" selection-start-line="139" selection-start-column="48" selection-end-line="139" selection-end-column="48" />
|
||||
<state relative-caret-position="204">
|
||||
<caret line="12" column="43" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/booking.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="473">
|
||||
<caret line="150" column="1" selection-start-line="79" selection-end-line="150" selection-end-column="1" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/router.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="34">
|
||||
<caret line="2" selection-start-line="2" selection-start-column="2" selection-end-line="18" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/routes.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
<caret line="23" column="3" selection-start-line="23" selection-start-column="3" selection-end-line="23" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.go">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="88" selection-start-line="14" selection-start-column="88" selection-end-line="14" selection-end-column="88" />
|
||||
<caret line="14" column="95" selection-start-line="14" selection-start-column="95" selection-end-line="14" selection-end-column="95" />
|
||||
<folding>
|
||||
<element signature="e#14#71#0" expanded="true" />
|
||||
<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="252">
|
||||
<caret line="224" column="70" selection-start-line="224" selection-start-column="70" selection-end-line="224" selection-end-column="70" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
@ -48,7 +48,7 @@ func addRow(data string) {
|
||||
}
|
||||
}
|
||||
|
||||
func getTerms(w http.ResponseWriter, r *http.Request) {
|
||||
func getTerms2(w http.ResponseWriter, r *http.Request) {
|
||||
enableCors(&w)
|
||||
|
||||
terms := []Term{}
|
||||
@ -83,7 +83,7 @@ func getTerms(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, string(out))
|
||||
}
|
||||
|
||||
func getTerm(w http.ResponseWriter, r *http.Request) {
|
||||
func getTerms(w http.ResponseWriter, r *http.Request) {
|
||||
enableCors(&w)
|
||||
vars := mux.Vars(r)
|
||||
|
||||
@ -123,6 +123,148 @@ func getTerm(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, string(out))
|
||||
}
|
||||
|
||||
func deleteTerm(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Println(string(body))
|
||||
var term Term
|
||||
err = json.Unmarshal(body, &term)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(term)
|
||||
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("DELETE FROM contracts WHERE date=$1;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
for i := 0; i < 1; i++ {
|
||||
|
||||
_, err = stmt.Exec(term.Date)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("UPDATE calendar SET status=$1, contractno=$2 WHERE date=$3;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
for i := 0; i < 1; i++ {
|
||||
|
||||
_, err = stmt.Exec(term.Status, term.Contractno, term.Date)
|
||||
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
|
||||
}
|
||||
|
||||
func putTerm(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Println(string(body))
|
||||
var term Term
|
||||
err = json.Unmarshal(body, &term)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(term)
|
||||
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("INSERT INTO contracts (date, status, contractno) VALUES ($1, $2, $3) ON CONFLICT (date) DO UPDATE SET status=$2, contractno=$3;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
for i := 0; i < 1; i++ {
|
||||
|
||||
_, err = stmt.Exec(term.Date, term.Status, term.Contractno)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
tx, err := db.Begin()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer tx.Rollback()
|
||||
stmt, err := tx.Prepare("UPDATE calendar SET status=$1, contractno=$2 WHERE date=$3;")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
defer stmt.Close()
|
||||
for i := 0; i < 1; i++ {
|
||||
|
||||
_, err = stmt.Exec(term.Status, term.Contractno, term.Date)
|
||||
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
|
||||
}
|
||||
|
||||
func postTest(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
|
||||
@ -140,10 +282,10 @@ func deleteTest(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Methods", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "content-Type")
|
||||
|
||||
//body, err := ioutil.ReadAll(req.Body)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("deleteTest");
|
||||
//log.Println(string(body));
|
||||
log.Println(string(body));
|
||||
}
|
10
main.go
10
main.go
@ -12,7 +12,7 @@ func main() {
|
||||
|
||||
alowedHeaders := handlers.AllowedHeaders([]string{"Content-Type"})
|
||||
allowedOrigins := handlers.AllowedOrigins([]string{"*"})
|
||||
allowedMethods := handlers.AllowedMethods([]string{"GET", "POST", "OPTIONS", "DELETE"})
|
||||
allowedMethods := handlers.AllowedMethods([]string{"GET", "POST", "OPTIONS", "DELETE", "PUT"})
|
||||
|
||||
initDb()
|
||||
defer db.Close()
|
||||
@ -20,7 +20,13 @@ func main() {
|
||||
//router := NewRouter()
|
||||
router:=mux.NewRouter()
|
||||
|
||||
router.HandleFunc("/term/{year}/{month}", getTerm).Methods("GET", "OPTIONS")
|
||||
router.HandleFunc("/term/{year}/{month}", getTerms).Methods("GET", "OPTIONS")
|
||||
router.HandleFunc("/term", deleteTerm).Methods("DELETE", "OPTIONS")
|
||||
router.HandleFunc("/term", putTerm).Methods("PUT", "OPTIONS")
|
||||
|
||||
router.HandleFunc("/query", newQuery).Methods("POST", "OPTIONS")
|
||||
|
||||
|
||||
router.HandleFunc("/test", postTest).Methods("POST", "OPTIONS")
|
||||
router.HandleFunc("/test", deleteTest).Methods("DELETE", "OPTIONS")
|
||||
log.Fatal(http.ListenAndServe(":8080", handlers.CORS(alowedHeaders, allowedOrigins, allowedMethods)(router)))
|
||||
|
@ -10,7 +10,7 @@ type NewQuery struct {
|
||||
Enddate string `json:"enddate"`
|
||||
Location string `json:"location"`
|
||||
Description string `json:"description"`
|
||||
Contactperson string `json:"contactperon"`
|
||||
Contactperson string `json:"contactperson"`
|
||||
Contactno string `json:"contactno"`
|
||||
Email string `json:"email"`
|
||||
Status int `json:"status"`
|
||||
|
40
router.go
40
router.go
@ -1,25 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"github.com/gorilla/mux"
|
||||
"./logger"
|
||||
)
|
||||
|
||||
func NewRouter() *mux.Router {
|
||||
router := mux.NewRouter().StrictSlash(true)
|
||||
for _, route := range routes {
|
||||
var handler http.Handler
|
||||
|
||||
handler = route.HandlerFunc
|
||||
handler = logger.Logger(handler, route.Name)
|
||||
|
||||
router.
|
||||
Methods(route.Method).
|
||||
Path(route.Pattern).
|
||||
Name(route.Name).
|
||||
Handler(handler)
|
||||
}
|
||||
|
||||
return router
|
||||
}
|
||||
//func NewRouter() *mux.Router {
|
||||
// router := mux.NewRouter().StrictSlash(true)
|
||||
// for _, route := range routes {
|
||||
// var handler http.Handler
|
||||
//
|
||||
// handler = route.HandlerFunc
|
||||
// handler = logger.Logger(handler, route.Name)
|
||||
//
|
||||
// router.
|
||||
// Methods(route.Method).
|
||||
// Path(route.Pattern).
|
||||
// Name(route.Name).
|
||||
// Handler(handler)
|
||||
// }
|
||||
//
|
||||
// return router
|
||||
//}
|
48
routes.go
48
routes.go
@ -1,28 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Route struct {
|
||||
Name string
|
||||
Method string
|
||||
Pattern string
|
||||
HandlerFunc http.HandlerFunc
|
||||
}
|
||||
|
||||
type Routes []Route
|
||||
|
||||
var routes = Routes{
|
||||
Route{"addTerm", "POST", "/term", newTerm},
|
||||
Route{"getTerms", "GET", "/term", getTerms},
|
||||
Route{"getTerm","GET","/term/{year}/{month}", getTerm},
|
||||
Route{"test", "GET", "/test", proba},
|
||||
|
||||
Route{"newQuery", "POST", "/query", newQuery},
|
||||
Route{"bookTerm", "POST", "/book", newBooking},
|
||||
Route{"bookTerm", "DELETE", "/book", delBooking},
|
||||
|
||||
Route{"postTest", "POST", "/test", postTest},
|
||||
Route{"postTest", "DELETE", "/test", deleteTest},
|
||||
}
|
||||
//type Route struct {
|
||||
// Name string
|
||||
// Method string
|
||||
// Pattern string
|
||||
// HandlerFunc http.HandlerFunc
|
||||
//}
|
||||
//
|
||||
//type Routes []Route
|
||||
//
|
||||
//var routes = Routes{
|
||||
// Route{"addTerm", "POST", "/term", newTerm},
|
||||
// Route{"getTerms", "GET", "/term", getTerms},
|
||||
// Route{"getTerm","GET","/term/{year}/{month}", getTerm},
|
||||
// Route{"test", "GET", "/test", proba},
|
||||
//
|
||||
// Route{"newQuery", "POST", "/query", newQuery},
|
||||
// Route{"bookTerm", "POST", "/book", newBooking},
|
||||
// Route{"bookTerm", "DELETE", "/book", delBooking},
|
||||
//
|
||||
// Route{"postTest", "POST", "/test", postTest},
|
||||
// Route{"postTest", "DELETE", "/test", deleteTest},
|
||||
//}
|
@ -23,7 +23,8 @@
|
||||
"src/assets"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.css"
|
||||
"src/styles.css",
|
||||
"node_modules/bootstrap/dist/css/bootstrap.min.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
@ -132,4 +133,4 @@
|
||||
}
|
||||
},
|
||||
"defaultProject": "szt-visio-app"
|
||||
}
|
||||
}
|
||||
|
909
szt-visio-app/package-lock.json
generated
909
szt-visio-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@
|
||||
"@angular/platform-browser": "~7.0.0",
|
||||
"@angular/platform-browser-dynamic": "~7.0.0",
|
||||
"@angular/router": "~7.0.0",
|
||||
"bootstrap": "^4.1.3",
|
||||
"bootstrap": "^4.2.1",
|
||||
"core-js": "^2.5.4",
|
||||
"hammerjs": "^2.0.8",
|
||||
"primeicons": "^1.0.0",
|
||||
@ -31,13 +31,13 @@
|
||||
"zone.js": "~0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.10.0",
|
||||
"@angular-devkit/build-angular": "^0.11.4",
|
||||
"@angular/cli": "~7.0.6",
|
||||
"@angular/compiler-cli": "~7.0.0",
|
||||
"@angular/language-service": "~7.0.0",
|
||||
"@types/node": "~8.9.4",
|
||||
"@types/jasmine": "~2.8.8",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "~8.9.4",
|
||||
"codelyzer": "~4.5.0",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
|
@ -15,7 +15,7 @@ import {TermListComponent} from './components/term-list/term-list.component';
|
||||
import {CreateQueryComponent} from './components/dialogs/create-query/create-query.component';
|
||||
import { AdminMenuComponent } from './components/admin-menu/admin-menu.component';
|
||||
import { TermListAdminComponent } from './components/term-list-admin/term-list-admin.component';
|
||||
import { EditTermAdminComponent } from './components/edit-term-admin/edit-term-admin.component';
|
||||
import { EditTermAdminComponent } from './components/dialogs/edit-term-admin/edit-term-admin.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -41,7 +41,7 @@ import { EditTermAdminComponent } from './components/edit-term-admin/edit-term-a
|
||||
// { enableTracking: true }
|
||||
)
|
||||
],
|
||||
entryComponents: [CreateQueryComponent],
|
||||
entryComponents: [CreateQueryComponent, EditTermAdminComponent],
|
||||
providers: [ ],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
|
@ -69,14 +69,15 @@
|
||||
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-3">
|
||||
<button mat-button mat-raised-button color="warn" (click)="onNoClick()">Zamknij</button>
|
||||
<button mat-button mat-raised-button color="warn" (click)="onAbort()">Zamknij</button>
|
||||
</div>
|
||||
|
||||
<div class="col-3" style="align: right">
|
||||
<button mat-button mat-raised-button color="primary" (click)="onTest()" [disabled]="form.invalid">Wyślij
|
||||
<button mat-button mat-raised-button color="primary" (click)="onSubmit()" [disabled]="form.invalid">Wyślij
|
||||
zapytanie
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,12 +1,8 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import {ErrorStateMatcher, MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
|
||||
import {FormControl, FormGroup, FormGroupDirective, NgForm, Validators} from '@angular/forms';
|
||||
import {CreateQuery} from '../../../models/CreateQuery';
|
||||
|
||||
export interface DialogData {
|
||||
animal: string;
|
||||
name: string;
|
||||
}
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef, MatSnackBar} from '@angular/material';
|
||||
import {FormControl, FormGroup, Validators} from '@angular/forms';
|
||||
import {Query} from '../../../models/Query';
|
||||
import {QueryService} from '../../../services/query.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-query',
|
||||
@ -18,11 +14,10 @@ export class CreateQueryComponent {
|
||||
test: string;
|
||||
form: FormGroup;
|
||||
|
||||
newQuery = new CreateQuery();
|
||||
newQuery = new Query();
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<CreateQueryComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: DialogData) {
|
||||
public dialogRef: MatDialogRef<CreateQueryComponent>, private queryService: QueryService, public snackBar: MatSnackBar) {
|
||||
|
||||
this.form = new FormGroup({
|
||||
startdate: new FormControl('', [Validators.required]),
|
||||
@ -35,13 +30,35 @@ export class CreateQueryComponent {
|
||||
});
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
// console.log(this.test);
|
||||
onAbort(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onTest() {
|
||||
console.log(this.form.value);
|
||||
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();
|
||||
|
||||
this.newQuery.location = this.form.controls.location.value;
|
||||
this.newQuery.description = this.form.controls.description.value;
|
||||
this.newQuery.contactperson = this.form.controls.contactperson.value;
|
||||
this.newQuery.contactno = this.form.controls.contactno.value;
|
||||
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 !');
|
||||
this.onAbort();
|
||||
},
|
||||
error => this.openSnackBar('Coś poszło nie tak.. Spróbuj ponownie'));
|
||||
}
|
||||
|
||||
openSnackBar(message: string) {
|
||||
this.snackBar.open(message, null, {
|
||||
duration: 2500,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
<div mat-dialog-content>
|
||||
<p>Edytuj termin</p>
|
||||
|
||||
<form [formGroup]="form">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<mat-form-field class="example-full-width">
|
||||
<input matInput [matDatepicker]="picker2" placeholder="Data" formControlName="date">
|
||||
<mat-datepicker-toggle matSuffix [for]="picker2"></mat-datepicker-toggle>
|
||||
<mat-datepicker #picker2></mat-datepicker>
|
||||
<mat-error *ngIf="form.get('date').hasError('required')">Pole jest wymagane</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<mat-form-field class="example-full-width">
|
||||
<!--<input matInput placeholder="Dostępność" formControlName="status">-->
|
||||
<!--<mat-error *ngIf="form.get('status').hasError('required')">Pole jest wymagane</mat-error>-->
|
||||
|
||||
|
||||
<mat-select placeholder="Dostępność" formControlName="status">
|
||||
<mat-option *ngFor="let status of statuses" [value]="status">
|
||||
{{status}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<mat-form-field class="example-full-width">
|
||||
<input matInput placeholder="nr umowy" formControlName="contractno">
|
||||
<mat-error *ngIf="form.get('contractno').hasError('required')">Pole jest wymagane</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<div class="container">
|
||||
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-3">
|
||||
<button mat-button mat-raised-button color="warn" (click)="onAbort()">Anuluj</button>
|
||||
</div>
|
||||
|
||||
<div class="col-3" style="align: right">
|
||||
<button mat-button mat-raised-button color="primary" (click)="onSubmit()" [disabled]="form.invalid">Zapisz
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,43 @@
|
||||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
|
||||
import {Term} from '../../../models/Term';
|
||||
import {FormControl, FormGroup, Validator, Validators} from '@angular/forms';
|
||||
import {TermAdminService} from '../../../services/termin-admin-service.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-term-admin',
|
||||
templateUrl: './edit-term-admin.component.html',
|
||||
styleUrls: ['./edit-term-admin.component.css']
|
||||
})
|
||||
export class EditTermAdminComponent implements OnInit {
|
||||
|
||||
form: FormGroup;
|
||||
statuses = ['wolny', 'zarezerwowany'];
|
||||
|
||||
constructor(private dialogRef: MatDialogRef<EditTermAdminComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: Term, private termAdminService: TermAdminService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.form = new FormGroup({
|
||||
date: new FormControl(this.data.date, Validators.required),
|
||||
status: new FormControl(this.data.status, Validators.required),
|
||||
contractno: new FormControl(this.data.contractno, Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
onAbort() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
const term = new Term();
|
||||
const dateTemp = new Date(this.form.controls.date.value);
|
||||
term.date = dateTemp.getFullYear() + '-' + dateTemp.getMonth() + 1 + '-' + dateTemp.getDay();
|
||||
term.status = this.form.controls.status.value;
|
||||
term.contractno = this.form.controls.contractno.value;
|
||||
console.log(term);
|
||||
this.termAdminService.updateTerm(term);
|
||||
}
|
||||
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
<p>
|
||||
edit-term-admin works!
|
||||
</p>
|
@ -1,15 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-term-admin',
|
||||
templateUrl: './edit-term-admin.component.html',
|
||||
styleUrls: ['./edit-term-admin.component.css']
|
||||
})
|
||||
export class EditTermAdminComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -19,47 +19,30 @@
|
||||
</mat-form-field>
|
||||
<button mat-raised-button color="primary" (click)="search()" [disabled]="form.invalid">Szukaj</button>
|
||||
</form>
|
||||
<button mat-raised-button color="primary" (click)="openDialog()">Zarezerwuj termin</button>
|
||||
</div>
|
||||
<br>
|
||||
<div style="margin: 0 auto; width: 80%">
|
||||
<table mat-table [dataSource]="allTerms$ | async" class="mat-elevation-z8">
|
||||
|
||||
<!-- Position Column -->
|
||||
<ng-container matColumnDef="weekDay">
|
||||
<th mat-header-cell *matHeaderCellDef>Dzień tygodnia</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.date | date: 'EEEE'}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="date">
|
||||
<th mat-header-cell *matHeaderCellDef>Data</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.date | date:'dd - MM - yyyy' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Weight Column -->
|
||||
<ng-container matColumnDef="availability">
|
||||
<th mat-header-cell *matHeaderCellDef>Dostępność</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="contractno">
|
||||
<th mat-header-cell *matHeaderCellDef>Nr Umowy</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.contractno}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef>Akcja</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button (click)="delete(element)">Usuń</button>
|
||||
</td>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<button (click)="edit()">Edytuj</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">dzień tygodnia</th>
|
||||
<th scope="col">data</th>
|
||||
<th scope="col">dostępność</th>
|
||||
<th scope="col">nr umowy</th>
|
||||
<th scope="col">akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let term of allTerms$ | async">
|
||||
<td>{{term.date | date: 'EEEE'}}</td>
|
||||
<td>{{term.date | date: 'dd - MM - yyyy' }}</td>
|
||||
<td>{{term.status}}</td>
|
||||
<td>{{term.contractno}}</td>
|
||||
<td><button mat-raised-button color="primary" (click)="editTerm(term)">Edytuj</button><button mat-raised-button color="warn" (click)="deleteTerm(term)">Usuń</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<button (click)="delete()">Delete</button>
|
||||
<button (click)="post()">Post</button>
|
||||
|
@ -2,26 +2,14 @@ import { Component, OnInit } from '@angular/core';
|
||||
import {FormControl, FormGroup, Validators} from '@angular/forms';
|
||||
import {Month} from '../../models/Month';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Terms} from '../../models/Term';
|
||||
import {Term} from '../../models/Term';
|
||||
import {TermService} from '../../services/term.service';
|
||||
import {MatDialog} from '@angular/material';
|
||||
import {DataSources} from '../environments/DataSources';
|
||||
import {CreateQueryComponent} from '../dialogs/create-query/create-query.component';
|
||||
import {PeriodicElement} from '../term-list/term-list.component';
|
||||
import {TerminAdminServiceService} from '../../services/termin-admin-service.service';
|
||||
|
||||
const ELEMENT_DATA: PeriodicElement[] = [
|
||||
{position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
|
||||
{position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
|
||||
{position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
|
||||
{position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
|
||||
{position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
|
||||
{position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
|
||||
{position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
|
||||
{position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'},
|
||||
{position: 9, name: 'Fluorine', weight: 18.9984, symbol: 'F'},
|
||||
{position: 10, name: 'Neon', weight: 20.1797, symbol: 'Ne'},
|
||||
];
|
||||
import {TermAdminService} from '../../services/termin-admin-service.service';
|
||||
import {EditTermAdminComponent} from '../dialogs/edit-term-admin/edit-term-admin.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-term-list-admin',
|
||||
@ -34,15 +22,9 @@ export class TermListAdminComponent implements OnInit {
|
||||
yearsList = [];
|
||||
monthsList: Month[];
|
||||
|
||||
displayedColumns: string[] = ['weekDay', 'date', 'availability', 'contractno', 'actions'];
|
||||
dataSource = ELEMENT_DATA;
|
||||
allTerms$: Observable<Array<Term>>;
|
||||
|
||||
allTerms$: Observable<Array<Terms>>;
|
||||
|
||||
animal: string;
|
||||
name: string;
|
||||
|
||||
constructor(private termService: TermService, private dialog: MatDialog, private terminAdminService: TerminAdminServiceService) {
|
||||
constructor(private termService: TermService, private termAdminService: TermAdminService, public dialog: MatDialog) {
|
||||
this.yearsList = DataSources.yearsList;
|
||||
this.monthsList = DataSources.monthsList;
|
||||
}
|
||||
@ -61,33 +43,32 @@ export class TermListAdminComponent implements OnInit {
|
||||
this.termService.getTerms(this.form.controls.year.value, this.form.controls.month.value);
|
||||
}
|
||||
|
||||
edit() {
|
||||
editTerm(event: Term) {
|
||||
console.log('asdasdasd');
|
||||
this.openDialog(event);
|
||||
}
|
||||
|
||||
delete(event: Terms) {
|
||||
// var date = new Date(event.date);
|
||||
// event.date = date.getFullYear() + '-' + date.getMonth() + 1 + '-' + date.getDay();
|
||||
// event.status = 'dostępny';
|
||||
// event.contractno = '';
|
||||
// console.log('data ', event.date);
|
||||
// this.terminAdminService.deleteTerm(event);
|
||||
this.terminAdminService.deleteTest();
|
||||
deleteTerm(event: Term) {
|
||||
const date = new Date(event.date);
|
||||
event.date = date.getFullYear() + '-' + date.getMonth() + 1 + '-' + date.getDay();
|
||||
event.status = 'wolny';
|
||||
event.contractno = '';
|
||||
console.log('data ', event.date);
|
||||
this.termAdminService.deleteTerm(event);
|
||||
}
|
||||
|
||||
post() {
|
||||
this.terminAdminService.postTest();
|
||||
this.termAdminService.postTest();
|
||||
}
|
||||
|
||||
openDialog(): void {
|
||||
const dialogRef = this.dialog.open(CreateQueryComponent, {
|
||||
openDialog(term: Term): void {
|
||||
const dialogRef = this.dialog.open(EditTermAdminComponent, {
|
||||
width: '65%',
|
||||
data: {name: this.name, animal: this.animal}
|
||||
data: term
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
console.log('The dialog was closed');
|
||||
this.animal = result;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,28 +23,26 @@
|
||||
</div>
|
||||
<br>
|
||||
<div style="margin: 0 auto; width: 80%">
|
||||
<table mat-table [dataSource]="allTerms$ | async" class="mat-elevation-z8">
|
||||
|
||||
<!-- Position Column -->
|
||||
<ng-container matColumnDef="weekDay">
|
||||
<th mat-header-cell *matHeaderCellDef>Dzień tygodnia</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.date | date: 'EEEE'}} </td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="date">
|
||||
<th mat-header-cell *matHeaderCellDef>Data</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.date | date:'dd - MM - yyyy' }}</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Weight Column -->
|
||||
<ng-container matColumnDef="availability">
|
||||
<th mat-header-cell *matHeaderCellDef>Dostępność</th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.status}} </td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">dzień tygodnia</th>
|
||||
<th scope="col">data</th>
|
||||
<th scope="col">dostępność</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let term of allTerms$ | async">
|
||||
<td>{{term.date | date: 'EEEE'}}</td>
|
||||
<td>{{term.date | date: 'dd - MM - yyyy' }}</td>
|
||||
<td>
|
||||
<button *ngIf="term.status==='wolny'" type="button" class="btn btn-success" disabled>Wolny</button>
|
||||
<button *ngIf="term.status==='zarezerwowany'" type="button" class="btn btn-danger" disabled>Zarezerwowany
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@ import {FormControl, FormGroup, Validators} from '@angular/forms';
|
||||
import {Month} from '../../models/Month';
|
||||
import {DataSources} from '../environments/DataSources';
|
||||
import {TermService} from '../../services/term.service';
|
||||
import {Terms} from '../../models/Term';
|
||||
import {Term} from '../../models/Term';
|
||||
import {Observable} from 'rxjs';
|
||||
import {MatDialog} from '@angular/material';
|
||||
import {CreateQueryComponent} from '../dialogs/create-query/create-query.component';
|
||||
@ -41,7 +41,7 @@ export class TermListComponent implements OnInit {
|
||||
displayedColumns: string[] = ['weekDay', 'date', 'availability'];
|
||||
dataSource = ELEMENT_DATA;
|
||||
|
||||
allTerms$: Observable<Array<Terms>>;
|
||||
allTerms$: Observable<Array<Term>>;
|
||||
|
||||
animal: string;
|
||||
name: string;
|
||||
|
@ -1,3 +1,25 @@
|
||||
<p>
|
||||
test works!
|
||||
</p>
|
||||
<!-- Button trigger modal -->
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
|
||||
Launch demo modal
|
||||
</button>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class CreateQuery {
|
||||
export class Query {
|
||||
startdate: string;
|
||||
enddate: string;
|
||||
location: string;
|
||||
@ -18,6 +18,6 @@ export class CreateQuery {
|
||||
this.contactno = '';
|
||||
this.email = '';
|
||||
this.status = 1;
|
||||
this.questiondate = '';
|
||||
this.questiondate = new Date().getFullYear() + '-' + new Date().getMonth() + 1 + '-' + new Date().getDay();
|
||||
}
|
||||
}
|
@ -1,6 +1,12 @@
|
||||
export interface Terms {
|
||||
export class Term {
|
||||
id: number;
|
||||
date: Date;
|
||||
status: string;
|
||||
contractno: string;
|
||||
|
||||
constructor() {
|
||||
this.date = null;
|
||||
this.status = 'wolny';
|
||||
this.contractno = '';
|
||||
}
|
||||
}
|
||||
|
12
szt-visio-app/src/app/services/query.service.spec.ts
Normal file
12
szt-visio-app/src/app/services/query.service.spec.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { QueryService } from './query.service';
|
||||
|
||||
describe('QueryService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: QueryService = TestBed.get(QueryService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
20
szt-visio-app/src/app/services/query.service.ts
Normal file
20
szt-visio-app/src/app/services/query.service.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {Query} from '../models/Query';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class QueryService {
|
||||
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
|
||||
createQuery(query: Query) {
|
||||
return this.httpClient.post(environment.API_BACK + 'query', query, httpOptions);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import {environment} from '../../environments/environment';
|
||||
import {Terms} from '../models/Term';
|
||||
import {Term} from '../models/Term';
|
||||
import {BehaviorSubject} from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
@ -15,12 +15,12 @@ export class TermService {
|
||||
endpoint = 'term';
|
||||
|
||||
// terms: Array<Terms>;
|
||||
private termsObs = new BehaviorSubject<Array<Terms>>([]);
|
||||
private termsObs = new BehaviorSubject<Array<Term>>([]);
|
||||
terms$ = this.termsObs.asObservable();
|
||||
|
||||
getTerms(year: string, month: string) {
|
||||
|
||||
return this.httpClient.get<Array<Terms>>(environment.API_BACK + this.endpoint + `/${year}/${month}`)
|
||||
return this.httpClient.get<Array<Term>>(environment.API_BACK + this.endpoint + `/${year}/${month}`)
|
||||
// this.httpClient.get('http://localhost:8080/term/' + year + '/' + month)
|
||||
.subscribe(x => {
|
||||
console.log(x);
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {environment} from '../../environments/environment';
|
||||
import {Term} from '../models/Term';
|
||||
import {RequestOptions} from '@angular/http';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
|
||||
@ -9,20 +11,23 @@ const httpOptions = {
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TerminAdminServiceService {
|
||||
|
||||
endpoint = 'book'
|
||||
export class TermAdminService {
|
||||
endpoint = 'term'
|
||||
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
|
||||
async deleteTerm(term: any) {
|
||||
deleteTerm(term: any) {
|
||||
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');
|
||||
|
||||
|
||||
return this.httpClient.delete(environment.API_BACK + this.endpoint, term)
|
||||
// @ts-ignore
|
||||
return this.httpClient.delete<Term>(environment.API_BACK + this.endpoint, new RequestOptions({
|
||||
headers: headers,
|
||||
body: term
|
||||
}))
|
||||
.subscribe(
|
||||
x => {
|
||||
console.log('usunięto');
|
||||
@ -31,7 +36,25 @@ export class TerminAdminServiceService {
|
||||
console.log('błąd usuwania');
|
||||
}
|
||||
);
|
||||
// await this.httpClient.delete(environment.API_BACK + this.endpoint, term);
|
||||
}
|
||||
|
||||
updateTerm(term: any) {
|
||||
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<Term>(environment.API_BACK + this.endpoint, term, headers)
|
||||
.subscribe(
|
||||
x => {
|
||||
console.log('zaktualizowane');
|
||||
},
|
||||
err => {
|
||||
console.log('niezaktualizowano');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
postTest() {
|
||||
|
BIN
szt_visio.exe
BIN
szt_visio.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user