|
@@ -1,32 +0,0 @@
|
1
|
|
-from flask import (
|
2
|
|
- Blueprint, flash, g, redirect, render_template, request, url_for
|
3
|
|
-)
|
4
|
|
-from werkzeug.exceptions import abort
|
5
|
|
-
|
6
|
|
-from app.db import get_db
|
7
|
|
-
|
8
|
|
-bp = Blueprint('admin', __name__)
|
9
|
|
-
|
10
|
|
-@bp.route('/admin', methods=('GET', 'POST'))
|
11
|
|
-def admin():
|
12
|
|
- if request.method == 'POST':
|
13
|
|
- eName = request.form['eName']
|
14
|
|
- office = request.form['oficina']
|
15
|
|
- last_turn = request.form['turno']
|
16
|
|
-
|
17
|
|
- db = get_db()
|
18
|
|
- station_query_res = db.execute(
|
19
|
|
- 'SELECT s_id FROM station WHERE nombre_empleado=?',
|
20
|
|
- (station_name,)
|
21
|
|
- ).fetchone()
|
22
|
|
- if station_query_res is not None:
|
23
|
|
- station_id = station_query_res[0]
|
24
|
|
- db.execute(
|
25
|
|
- 'INSERT INTO station (nombre_empleado, oficina, last_turn)'
|
26
|
|
- ' VALUES (?, ?, ?)',
|
27
|
|
- (eName, office, 0)
|
28
|
|
- )
|
29
|
|
- db.commit()
|
30
|
|
- return redirect(url_for('admin'))
|
31
|
|
-
|
32
|
|
- return render_template('admin.html')
|