Добавил поиск
This commit is contained in:
		
							parent
							
								
									b78685db0b
								
							
						
					
					
						commit
						c52dc734f6
					
				
							
								
								
									
										27
									
								
								web/app.py
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								web/app.py
									
									
									
									
									
								
							@ -16,7 +16,7 @@ app = Flask(__name__)
 | 
			
		||||
internal = {}
 | 
			
		||||
external = {}
 | 
			
		||||
State = ""
 | 
			
		||||
 | 
			
		||||
findLimit = 1000
 | 
			
		||||
 | 
			
		||||
@app.route("/")
 | 
			
		||||
def root():
 | 
			
		||||
@ -32,27 +32,20 @@ def WebCall():
 | 
			
		||||
    call = coll_call.find().sort('time', -1)
 | 
			
		||||
    return render_template("WebCall.html", call=call)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route("/web/call/test/")
 | 
			
		||||
def GetTest():
 | 
			
		||||
    call = coll_call.find({'client': {'$nin': IgnoreList}}).sort('time', -1)
 | 
			
		||||
    return render_template("TestCall.html", call=call)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route("/web/call/test/<id>")
 | 
			
		||||
def GetTestId(id):
 | 
			
		||||
    call = coll_call.find(
 | 
			
		||||
        {'client': {'$nin': IgnoreList}, 'status': int(id)}).sort('time', -1)
 | 
			
		||||
    return render_template("TestCall.html", call=call)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route("/web/call/status/<id>")
 | 
			
		||||
def WebCallStatus(id):
 | 
			
		||||
    call = coll_call.find({"status": int(id)}).sort('time', -1)
 | 
			
		||||
    call = coll_call.find(
 | 
			
		||||
        {'client': {'$nin': IgnoreList}, 'status': int(id)}).sort('time', -1)
 | 
			
		||||
        {'client': {'$nin': IgnoreList}, 'status': int(id)}).limit(findLimit).sort('time', -1)
 | 
			
		||||
    return render_template("WebCall.html", call=call)
 | 
			
		||||
 | 
			
		||||
@app.route("/web/call/find/", methods=["GET"])
 | 
			
		||||
def WebCallFind():
 | 
			
		||||
    try:
 | 
			
		||||
        id = str(request.args.get("client"))
 | 
			
		||||
        call = coll_call.find({"client":  {"$regex": str(id)}}).limit(findLimit).sort('time', -1)
 | 
			
		||||
        return(render_template("WebCall.html", call=call)) 
 | 
			
		||||
    except Exception as e:
 | 
			
		||||
        return(str(e))
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    app.debug = True
 | 
			
		||||
 | 
			
		||||
@ -42,6 +42,29 @@ a {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
header {
 | 
			
		||||
    height: 50px;
 | 
			
		||||
    height: 80px;
 | 
			
		||||
    vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.search {
 | 
			
		||||
    height: 30px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.search_label {
 | 
			
		||||
    color: chocolate;
 | 
			
		||||
    font-family: Verdana, Geneva, Tahoma, sans-serif;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.search_text {
 | 
			
		||||
    color: chocolate;
 | 
			
		||||
    font-family: Verdana, Geneva, Tahoma, sans-serif;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    width: 200px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.search_btn {
 | 
			
		||||
    color: chocolate;
 | 
			
		||||
    font-family: Verdana, Geneva, Tahoma, sans-serif;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
@ -12,13 +12,19 @@
 | 
			
		||||
    <a href="/web/call/status/0">Входящий вызов принят</a>
 | 
			
		||||
    <a href="/web/call/status/1">Входящий вызов не принят</a>
 | 
			
		||||
    <a href="/web/call/status/2">Перезвонили</a>
 | 
			
		||||
 | 
			
		||||
    <p>
 | 
			
		||||
    <form name="search" action="/web/call/find/" method="get" class="search">
 | 
			
		||||
        <label class="search_label">Поиск</label>
 | 
			
		||||
        <input class="search_text" type="text" name="client">
 | 
			
		||||
        <input class="search_btn" type="submit" title="Найти">
 | 
			
		||||
    </form>
 | 
			
		||||
    </p>
 | 
			
		||||
</header>
 | 
			
		||||
<table>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td>Номер клиента</td>
 | 
			
		||||
        <!-- <td>Номер оператора</td> -->
 | 
			
		||||
        <td>Дата время</td>
 | 
			
		||||
        <td>Статус звонка</td>
 | 
			
		||||
        <td>Ссылка на запись</td>
 | 
			
		||||
    </tr>
 | 
			
		||||
 | 
			
		||||
@ -33,6 +39,17 @@
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            <!-- <td>{{ entry.Operator }}</td> -->
 | 
			
		||||
            <td>{{ entry.time }}</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                {% if entry.status == 0 %}
 | 
			
		||||
                    Вызов принят
 | 
			
		||||
                {% elif entry.status == 1 %}
 | 
			
		||||
                    Вызов не принят
 | 
			
		||||
                {% elif entry.status == 2 %}
 | 
			
		||||
                    Перезвонили
 | 
			
		||||
                {% elif entry.status == 9 %}
 | 
			
		||||
                    Абонент заблокирован
 | 
			
		||||
                {% endif %}
 | 
			
		||||
            </td>
 | 
			
		||||
            <td>
 | 
			
		||||
                {% if entry.recordUrl|length > 1 %}
 | 
			
		||||
                <audio src="{{ entry.recordUrl }}" type="audio/mp3" preload="none" controls>Запись</audio>
 | 
			
		||||
 | 
			
		||||
@ -12,21 +12,34 @@
 | 
			
		||||
    <a href="/web/call/status/0">Входящий вызов принят</a>
 | 
			
		||||
    <a href="/web/call/status/1">Входящий вызов не принят</a>
 | 
			
		||||
    <a href="/web/call/status/2">Перезвонили</a>
 | 
			
		||||
 | 
			
		||||
</header>
 | 
			
		||||
 | 
			
		||||
<form name="search" action="/web/call/find/" method="get">
 | 
			
		||||
    <label>Поиск</label>
 | 
			
		||||
    <input type="text" name="client" value="">
 | 
			
		||||
    <input type="submit" title="Найти">
 | 
			
		||||
</form>
 | 
			
		||||
    
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td>Номер клиента</td>
 | 
			
		||||
        <!-- <td>Номер оператора</td> -->
 | 
			
		||||
        <td>Дата время</td>
 | 
			
		||||
        <td>Дата время события</td>
 | 
			
		||||
        <td>Ссылка на запись</td>
 | 
			
		||||
        
 | 
			
		||||
    </tr>
 | 
			
		||||
 | 
			
		||||
    <body>
 | 
			
		||||
        {% for entry in call %}
 | 
			
		||||
        <tr>
 | 
			
		||||
            <!-- <td>{{ entry.client }}</td> -->
 | 
			
		||||
            <td><a href="tel:{{ entry.client }}">{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}</a></td>
 | 
			
		||||
            {% if entry.important == True %}
 | 
			
		||||
                <td><font color="#C30000">{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}</font></td>
 | 
			
		||||
            {% else %}
 | 
			
		||||
                <td >{{ "%s %s %s %s"|format(entry.client[0:1], entry.client[1:4], entry.client[4:7], entry.client[7:11]) }}</td>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
            <!-- <td>{{ entry.Operator }}</td> -->
 | 
			
		||||
            <td>{{ entry.time }}</td>
 | 
			
		||||
            <td>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user