|
@@ -56,8 +56,6 @@
|
|
|
import marked from 'marked'
|
|
|
export let privat
|
|
|
let projekte = []
|
|
|
- let pp
|
|
|
- let modal = false
|
|
|
const { Pool } = R('pg')
|
|
|
const _ = R('lodash')
|
|
|
const pool = new Pool({ connectionString: privat.mein_bk_db})
|
|
@@ -79,39 +77,4 @@
|
|
|
(err, resp) => projekte = resp.rows)
|
|
|
}
|
|
|
projekte_laden()
|
|
|
- function modal_toggle (p) {
|
|
|
- pp = p
|
|
|
- modal = true
|
|
|
- }
|
|
|
- function loeschen (p) {
|
|
|
- const query = `DELETE FROM projekte
|
|
|
- WHERE id = $1`
|
|
|
- pool.query(query, [p.id], (err, res) => {
|
|
|
- if (err) {
|
|
|
- console.log(err)
|
|
|
- return
|
|
|
- }
|
|
|
- projekte = projekte.filter(pp => pp !== p)
|
|
|
- })
|
|
|
- }
|
|
|
- function speichern (pp) {
|
|
|
- const query = `UPDATE projekte
|
|
|
- SET (titel, leitung, beschreibung, bildung, max_teilnehmer,
|
|
|
- schulnah, ort, treffpunkt, woche, mo_di, mi_do, vortermin,
|
|
|
- material, kosten, info_an_organisationsteam, raumwunsch,
|
|
|
- medienwunsch, presi) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)
|
|
|
- WHERE projekte.id = $19
|
|
|
- RETURNING *`
|
|
|
- const value = [pp.titel, pp.leitung, pp.beschreibung, pp.bildung, pp.max_teilnehmer,
|
|
|
- pp.schulnah, pp.ort, pp.treffpunkt, pp.woche, pp.mo_di, pp.mi_do, pp.vortermin,
|
|
|
- pp.material, pp.kosten, pp.info_an_organisationsteam, pp.raumwunsch,
|
|
|
- pp.medienwunsch, pp.presi,
|
|
|
- pp.id]
|
|
|
- pool.query(query, value, (err, res) => {
|
|
|
- err && console.log(err)
|
|
|
- pp = res[0]
|
|
|
- projekte = projekte
|
|
|
- modal = false
|
|
|
- })
|
|
|
- }
|
|
|
</script>
|