{% extends "main.html" %}
{% block contents %}
<style>
html,
body,
h1,
h2,
h3,
div,
span,
a,
button,
table,
tbody,
thead,
input {
margin: 0;
padding: 0;
box-sizing: border-box;
}
header {
background-color: hsl(57, 95%, 60%);
}
body {
min-height: 110%;
background-color: hsl(186, 77%, 74%);
}
.clicked {
background-color: rgb(59, 62, 147);
/* border-radius: 20%; */
color: rgb(232, 132, 37);
display: flex;
text-align: start;
flex-direction: column;
width: 150px;
}
.clicked>ul>span {
text-align: center;
}
.btn btn-warning {
margin: 0;
padding: 0;
}
ol,
ul {
padding: 4px 4px 4px 4px;
/* margin: auto; */
}
/* .btn btn-secondary btn-lg {
zoom: 0.5;
margin: 0;
padding: 0;
} */
.wrap {
/* background-color: chartreuse; */
width: 1600px;
height: 300px;
margin: auto;
border: 1px;
}
td>input {
border: none;
}
th>input {
border: none;
}
tr {
cursor: pointer;
}
td>button {
zoom: 0.65;
}
.total {
height: 800px;
}
table {
width: 1200px;
table-layout: fixed;
}
.flex-row {
display: flex;
flex-direction: row;
align-items: flex-start
/* justify-content: center; */
}
.flex-col {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.list-group {
background-color: rgb(13, 170, 233);
color: white;
width: 200px;
}
.list-group>ul {
height: 650px;
}
.list-group>ul>li {
height: 30px;
}
tr {
width: 1000px;
}
.add-form>td {
background-color: rgb(173, 214, 243);
}
.clicked{
background-color: azure;
color: blue;
width: 200px;
height: 30px;
}
.sum {
margin-right: 10px;
margin-left: auto;
background-color: rgb(212, 250, 130);
font-size: 20px;
font-weight: 500;
padding: auto;
border: 1.5px solid rgb(13, 59, 132);
}
.sum>span {
/* border: 1.5px solid rgb(13, 59, 132); */
margin-left: 2px;
}
.input {
width: 1600px;
background-color: rgb(222, 240, 164);
height: 350px;
display: none;
}
.btn>button {
margin-left: auto;
margin-right: 10px;
width: 100px;
height: 50px;
}
tr {
cursor: pointer;
}
.listclick{
border-color:blueviolet;
border-style: dashed;
box-shadow: 50cm;
border-width: 2px;
}
</style>
<script>
// let mv_id
$(document).ready(() => {
d_list()
})
function d_list(id) {
// console.log(id)
if (id == undefined) {
fetch(`/freight/d_bar_lists`).then(res => res.json()).then(data => {
let rows = data['result'];
$("#list").empty();
rows.forEach((row) => {
let id = row['_id']
let msn = row['msn']
let hauju = row['hauju']
let p_name = row['p_name']
let offer = row['offer']
let gangjung = row['gangjung']
let size = row['size']
let bundle = row['bundle']
let mt = row['mt']
let storage = row['storage']
let mv_id = row['mv_id']
let temp_html = ` <tr id='${id}_add' onclick="list_click('${id}')">
<td name="msn">${msn}</td>
<td>${hauju}</td>
<td>${p_name}</td>
<td>${offer}</td>
<td>${gangjung}</td>
<td>${size}</td>
<td>${bundle}</td>
<td>${mt}</td>
<td>${storage}</td>
</tr>`
$("#list").append(temp_html)
})
})
}
else {
let url = `/freight/d_bar_lists?data=${id}`
fetch(url).then(res => res.json()).then(data => {
// let name = data["mv_name"]
// console.log(name)
let rows = data['result'];
$("#list").empty();
rows.forEach((row) => {
let id = row['_id']
let msn = row['msn']
let hauju = row['hauju']
let p_name = row['p_name']
let offer = row['offer']
let gangjung = row['gangjung']
let size = row['size']
let bundle = row['bundle']
let mt = row['mt']
let storage = row['storage']
let mv_id = row['mv_id']
let temp_html = ` <tr id='${id}_add' onclick="list_click('${id}')">
<td name="msn">${msn}</td>
<td>${hauju}</td>
<td>${p_name}</td>
<td>${offer}</td>
<td>${gangjung}</td>
<td>${size}</td>
<td>${bundle}</td>
<td>${mt}</td>
<td>${storage}</td>
</tr>`
$("#list").append(temp_html)
})
})
}
}
function mv_click(id) {
$(`#mv_mv`).text(`${id}`)
$(`.list-group`).addClass('clicked')
$(`#${id}`).removeClass('clicked')
d_list(id)
$(`.input`).hide();
}
function d_input() {
$('.input').show()
}
function list_click(id) {
console.log(id)
$(`.listclick`).removeClass('listclick')
$(`#${id}_add`).addClass('listclick')
}
</script>
<header>
<div class="flex-row">
<div>
{% for d_list in d_lists %}
<a id="{{d_list._id}}" class="list-group" onclick="mv_click(`${id}`)" name="mv_name">{{d_list.date}}
{{d_list.mv_name}}</a>
{% endfor %}
</div>
<div class="btn">
<button type="button" class="btn btn-success" onclick="d_input()">입고</button>
</div>
</div>
</header>
<body>
<div class="flex-col">
<div class="wrap bd-sidbar">
<table class="table" style="border: 8px blue;">
<thead class="table-primary">
<tr>
<th scope="col">MSN</th>
<th scope="col">화주명</th>
<th scope="col">품명</th>
<th scope="col">제강사</th>
<th scope="col">강종</th>
<th scope="col">싸이즈</th>
<th scope="col">총수량(B/D)</th>
<th scope="col">총중량(M/T)</th>
<th scope="col">입고창고</th>
</tr>
</thead>
<tbody class="table table-striped table" id=list class="add-form">
<!-- <tr class="add-form_1" id="add-form_1" style="background-color: aqua;">
<td><input type="text" placeholder="MSN" name="msn"></td>
<td><input type="text" placeholder="화주명" name="hauju"></td>
<td><input type="text" placeholder="세부품명" value="d_bar" name="p_name"></td>
<td><input type="text" placeholder="제강사" name="offer"></td>
<td><input type="text" placeholder="강 종" name="gangjung"></td>
<td><input type="text" placeholder="싸이즈" name="size"></td>
<td><input type="text" placeholder="수 량" name="bundle"></td>
<td><input type="text" placeholder="톤수" name="mt"></td>
<td><input type="text" placeholder="창고코드" name="storage"></td>
</td>
</tr> -->
</tbody>
</table>
</div>
<div class="input">
<form >
<table>
<td><input type="text" placeholder="차량번호" name="tc_no"></td>
<td><input type="text" placeholder="차량번호" name="tc_no"></td>
</table>
</form>
</div>
</div>
</body>
{% endblock %}
from main import *
from flask import Blueprint
from bson.objectid import ObjectId
bp = Blueprint("freight", __name__, url_prefix='/freight')
@bp.route("/")
def freight():
d_lists = list(db.mv.find({"cago_name": "철근"}))
return render_template("freight.html",d_lists=d_lists,title="철근상세")
@bp.route('/d_bar_lists',methods=['GET'])
def d_bar_lists():
data = request.args.get('data')
d_details = list(db.d_list.find({'mv_id':data}))
for d_detail in d_details:
d_detail["_id"] = str(d_detail['_id'])
return jsonify({"result": d_details})