상세 컨텐츠

본문 제목

입고 2

python

by bumychoi 2024. 5. 7. 23:11

본문

{% 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;
    }

    .form_in {
        width: 1800px;
    }
</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(id) {
        temp_html = `   <tr id=${id}id_list class=form_in>
                            <td><input type="text" placeholder="차량번호" name="tc_no"></td>
                            <td><input type="text" placeholder="수량" name="huju"></td>
                            <td><input type="text" placeholder="중량" name="huju"></td>
                            <td><input type="text" placeholder="강종" name="tc_no"></td>
                            <td><input type="text" placeholder="제강사" name="tc_no"></td>
                            <td><input type="text" placeholder="사이즈" name="tc_no"></td>
                           
                        </tr>
                    `
        $("#list_up").append(temp_html)

    }
    function list_click(idx) {
        console.log(idx)
        $(`.listclick`).removeClass('listclick')
        $(`#${idx}_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=form_in>
            <tr id=${id}id_list>
                <td><input type="text" placeholder="차량번호" name="tc_no"></td>
                <td><input type="text" placeholder="수량" name="huju"></td>
                <td><input type="text" placeholder="중량" name="huju"></td>
                <td><input type="text" placeholder="강종" name="tc_no"></td>
                <td><input type="text" placeholder="제강사" name="tc_no"></td>
                <td><input type="text" placeholder="사이즈" name="tc_no"></td>
                <div class="btn">
                    <button type="button" class="btn btn-success" onclick="d_input()">입고</button>
                </div>
            </tr>
        </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>
        <table>
            <tbody class="table table-striped table">
                <div>
                </div>
            </tbody>
        </table>
    </div>
</body>
{% endblock %}

'python' 카테고리의 다른 글

출고입력창 완성  (0) 2024.05.09
입력란 클릭 자료 받아오기  (0) 2024.05.09
추가작업 입고란 추가  (0) 2024.05.07
입고페이지  (1) 2024.05.04
합계출력  (0) 2024.04.30

관련글 더보기