<!doctype html>
<html ng-app="myApp" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>TrainTicket Admin</title>
    <meta name="description" content="This is the admin page of TrainTicket system">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.css">
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="stylesheet" href="assets/css/client.css">

    <script type="text/javascript" src="assets/js/vue.js"></script>

    <script type="text/javascript" src="assets/js/client_common.js" defer charset="utf-8"></script>
    <script type="text/javascript" src="assets/js/client_order_list.js" defer charset="utf-8"></script>
    <script type="text/javascript" src="assets/js/jquery.shCircleLoader-min.js" defer charset="utf-8"></script>


</head>

<body data-type="generalComponents">
    <header class="am-topbar am-topbar-inverse admin-header">
        <div class="am-topbar-brand">
            <a href="javascript:;" class="tpl-logo">
                <img src="assets/img/logo.png" alt="">
            </a>
        </div>
        <div class="am-icon-list tpl-header-nav-hover-ico am-fl am-margin-right">

        </div>

        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only"
            data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span
                class="am-icon-bars"></span></button>

        <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

            <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
                <li id="goto_admin">
                    <a href="adminlogin.html" class="tpl-header-list-link">
                        <span>admin-panel</span>
                    </a>
                </li>

                <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"
                        class="tpl-header-list-link"><span class="am-icon-arrows-alt"></span> <span
                            class="admin-fullText">FullScreen</span></a></li>

                <li id="name-wrap" class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                    <a>
                        <span class="tpl-header-list-user-nick" id="client_name">Not Login</span>
                    </a>
                </li>

                <li id="upload-avatar">
                    <a>
                        <span class="tpl-header-list-user-ico">
                            <img id="avatar_img">
                        </span>
                    </a>
                </li>
                <li id="logout_button"><a href="#" class="tpl-header-list-link"><span
                            class="am-icon-sign-out tpl-header-list-ico-out-size"></span></a></li>
            </ul>
        </div>
    </header>

    <div class="tpl-page-container tpl-page-header-fixed" ng-controller="indexCtrl">
        <div class="tpl-left-nav tpl-left-nav-hover">
            <div class="tpl-left-nav-title">
                Management
            </div>
            <div class="tpl-left-nav-list">
                <ul class="tpl-left-nav-menu">
                    <li class="tpl-left-nav-item">
                        <a href="index.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-list-alt"></i>
                            <span>Ticket Reserve</span>
                        </a>
                    </li>

                    <li class="tpl-left-nav-item">
                        <a href="client_order_list.html" class="nav-link active">
                            <i class="am-icon-line-chart"></i>
                            <span>Order List</span>
                            <i class="am-icon-star tpl-left-nav-content-ico am-fr am-margin-right"></i>
                        </a>
                    </li>

                    <li class="tpl-left-nav-item">
                        <a href="client_consign_list.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-globe"></i>
                            <span>Consign List</span>
                        </a>
                    </li>


                    <li class="tpl-left-nav-item">
                        <a href="client_adsearch.html" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-users"></i>
                            <span> Advanced Search</span>
                        </a>
                    </li>

                    <li class="tpl-left-nav-item">
                        <!-- 打开状态 a 标签添加 active 即可   -->
                        <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                            <i class="am-icon-table"></i>
                            <span>Execute Flow</span>
                            <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                        </a>
                        <ul class="tpl-left-nav-sub-menu">
                            <li>
                                <!-- 打开状态 a 标签添加 active 即可   -->
                                <a href="client_ticket_collect.html" class="active">
                                    <i class="am-icon-user"></i>
                                    <span>Ticket Collect</span>
                                </a>

                                <a href="client_enter_station.html">
                                    <i class="am-icon-institution"></i>
                                    <span>Enter Station</span>
                                </a>
                            </li>
                        </ul>
                    </li>


                </ul>
            </div>
        </div>

        <div class="tpl-content-wrapper" id="orderListApp">
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                    <div class="caption font-green bold">
                        Order & Voucher
                    </div>

                </div>

                <div class="change_cancel_table">
                    <div id="my-svg-change-order"></div>
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                            <tr>
                                <th class="table-title">No.</th>
                                <th class="table-set">Order Id</th>
                                <th class="table-title">From</th>
                                <th class="table-title">To</th>
                                <th class="table-date">Bought Date</th>
                                <th class="table-date">Trip Id</th>
                                <th class="table-title">Seat Number</th>
                                <th class="table-title">Status</th>
                                <th class="table-title">Price</th>
                                <th class="table-title">Name</th>
                                <th class="table-title">Document Type</th>
                                <th class="table-title">Document Number</th>
                                <th class="table-title">Consign</th>
                                <th class="table-title">Voucher</th>
                                <th class="table-title">Operation</th>

                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat=" record in records" v-for="(item, index) in myOrderList">
                                <td>{{index}}</td>
                                <td>{{item.id}}</td>
                                <td>{{item.from}}</td>
                                <td>{{item.to}}</td>
                                <td>{{item.boughtDate}}</td>
                                <td>{{item.trainNumber}}</td>
                                <td>{{item.seatNumber}}</td>

                                <td>
                                    <label class="noshow_component my_order_list_status">{{item.status}}</label>
                                    {{statusExpress[item.status]}}
                                    <button v-if="item.status == '0'"
                                        class="am-btn am-btn-default am-btn-xs am-text-secondary am-btn"
                                        v-on:click="payMyOrder(index, item.id, item.trainNumber,item.price)"
                                        data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0, width: 1100, height: 350}">
                                        <span class="am-icon-pencil-square-o"></span> Pay
                                    </button>
                                </td>

                                <td>{{item.price}}</td>
                                <td>{{item.contactsName}}</td>
                                <td>{{item.documentType}}</td>
                                <td>{{item.contactsDocumentNumber}}</td>
                                <td>
                                    <button v-if="item.status == '0' ||  item.status == '1' || item.status == '2'"
                                        v-on:click="consignOrder(item.id, item.from, item.to, item.boughtDate)"
                                        class="am-btn am-btn-default am-btn-xs am-text-secondary am-btn">
                                        <span class="am-icon-pencil-square-o"></span> Consign
                                    </button>

                                    <label v-if="item.status != '0' &&  item.status != '1' && item.status != '2'"
                                        class="am-btn am-btn-default am-btn-xs am-text-danger">
                                        Not operable
                                    </label>
                                </td>
                                <td>
                                    <button v-if="item.status == '6'"
                                        v-on:click="printVancher(item.id, item.trainNumber)"
                                        data-am-modal="{target: '#doc-modal-vancher', closeViaDimmer: 0, width: 560, height: 450}"
                                        class="am-btn am-btn-default am-btn-xs am-text-danger">
                                        <span class="am-icon-trash-o"></span> Print Voucher
                                    </button>
                                    <label v-if="item.status != '6'"
                                        class="am-btn am-btn-default am-btn-xs am-text-danger">
                                        Not operable
                                    </label>
                                </td>

                                <td>
                                    <div class="am-btn-toolbar my-am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <button v-if="item.status == '1'" style="display:inline"
                                                class="am-btn am-btn-default am-btn-xs am-text-secondary am-btn"
                                                v-on:click="changeMyOrder(item.from, item.to, item.status, item.id,item.trainNumber)"
                                                data-am-modal="{target: '#doc-modal-2', closeViaDimmer: 0, width: 1100, height: 350}">
                                                <span class="am-icon-pencil-square-o"></span> Change
                                            </button>

                                            <!--<button class="am-btn am-btn-default am-btn-xs am-hide-sm-only"><span class="am-icon-copy"></span> 复制</button>-->
                                            <button
                                                v-if="item.status == '1' || item.status == '0' ||  item.status == '3'"
                                                style="display:inline" v-on:click="cancelOrder(item.id , item.status)"
                                                v-on:click="cancelOrder(item.id , item.status)"
                                                class="am-btn am-btn-default am-btn-xs am-text-danger">
                                                <span class="am-icon-trash-o"></span> Cancel
                                            </button>
                                        </div>
                                    </div>

                                </td>
                            </tr>
                        </tbody>
                    </table>


                    <!--vancher dialog-->
                    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-vancher">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">Voucher
                                <a href="javascript: void(0)" class="am-close am-close-spin"
                                    data-am-modal-close>&times;</a>
                            </div>
                            <div class="am-modal-bd" style="margin-left: 15px;margin-right: 15px;margin-bottom: 20px; ">
                                <table class="am-table am-table-striped am-table-hover">
                                    <tbody align="left">
                                        <tr>
                                            <td>Voucher Number:</td>
                                            <td colspan="2">10000{{vancher.voucher_id}}</td>
                                        </tr>

                                        <tr>
                                            <td>Order Id:</td>
                                            <td colspan="2">{{vancher.order_id}}</td>
                                        </tr>

                                        <tr>
                                            <td>Bought Date:</td>
                                            <td colspan="2">{{vancher.travelDate}}</td>
                                        </tr>

                                        <tr>
                                            <td>Passenger Name:</td>
                                            <td colspan="2">{{vancher.contactName}}</td>
                                        </tr>

                                        <tr>
                                            <td>Train Number:</td>
                                            <td colspan="2">{{vancher.train_number}}</td>
                                        </tr>


                                        <tr>
                                            <td>Seat Number:</td>
                                            <td colspan="2">{{vancher.seat_number}}</td>
                                        </tr>

                                        <tr>
                                            <td>Start Station:</td>
                                            <td colspan="2">{{vancher.start_station}}</td>
                                        </tr>
                                        <tr>
                                            <td>Destination Station:</td>
                                            <td colspan="2">{{vancher.dest_station}}</td>
                                        </tr>

                                        <tr>
                                            <td>Price:</td>
                                            <td colspan="2">{{vancher.price}}</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>

                    <!--  consign -->
                    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt-consign">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">consign order</div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>consign name:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_name" class="form-control" name='' v-model="consignName"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>consign phone:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_phone" class="form-control" name='' v-model="consignPhone">
                                    </li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>consign weight :</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_weight " class="form-control" name='' v-model="consignWeight">
                                    </li>
                                </div>
                            </div>


                            <div class="am-modal-footer">
                                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                <span class="am-modal-btn" id="submit_for_consign" data-am-modal-confirm>提交</span>
                            </div>
                        </div>
                    </div>


                    <!--  pay-->
                    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">Pay For Reserve</div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>orderId:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_orderId" class="form-control" name='' v-model="orderId"
                                        readonly="readonly"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>tripId:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_tripId" class="form-control" name='' v-model="tripId"
                                        readonly="readonly"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>price:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_price" class="form-control" name='' v-model="price"
                                        readonly="readonly"></li>
                                </div>
                            </div>


                            <div class="am-modal-footer">
                                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                <span class="am-modal-btn" id="pay_for_preserve" data-am-modal-confirm>提交</span>
                            </div>
                        </div>
                    </div>


                    <div id="ticket_cancel_panel" class="flow_rebook panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                Cancel Order
                            </h3>
                        </div>
                        <div class="panel-body">
                            <form role="form" class="form-horizontal">
                                <div class="form-group">
                                    <label class="control-label">Cancel The Ticket? You will get
                                        <label id="cancel_money_refund"> none </label>
                                        refund.</label>
                                    <label>Ticket Order Id:<label id="ticket_cancel_order_id">
                                            none </label></label>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-10">
                                        <button id="ticket_cancel_panel_cancel" v-on:click="noPay()" type="button"
                                            class="btn btn-primary">
                                            No.
                                        </button>
                                        <button id="ticket_cancel_panel_confirm" v-on:click="onPay()" type="button"
                                            class="btn btn-default">
                                            Yes.
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>


                    <div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-2">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">Change Your Order <div id="my-svg"></div>
                                <a href="javascript: void(0)" class="am-close am-close-spin"
                                    data-am-modal-close>&times;</a>
                            </div>
                            <div class="am-modal-bd">
                                <div id="re_book_dialog">
                                    <ul>
                                        <li><input id="re_booking_startingPlace" class="form-control" name=''
                                                v-model="from"></li>

                                        <li><input id="re_booking_terminalPlace" class="form-control" name=''
                                                v-model="to"></li>
                                        <li><input id="re_booking_date" class="form-control" type="date" name=''
                                                v-model="dateOfToday" min="2017-07-13"></li>

                                        <li><select id="search_select_train_type" class="form-control" name="train_type"
                                                v-model="trainTypeSelected">
                                                <option v-for="option in options" v-bind:value="option.value">
                                                    {{option.text}}
                                                </option>
                                            </select></li>

                                        <li>
                                            <button id="travel_booking_button" type="button" class="btn btn-primary"
                                                v-on:click="searchRouteList()">
                                                Search
                                            </button>
                                        </li>
                                    </ul>
                                </div>

                                <div class="panel-body rebooking">
                                    <table id="re_booking_list_table" class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>No.</th>
                                                <th>Trip Id</th>
                                                <th>Train Type Id</th>
                                                <th>From</th>
                                                <th>To</th>
                                                <th>Starting Time</th>
                                                <th>End Time</th>
                                                <th>2rd Class Seat Number</th>
                                                <th>1st Class Seat Number</th>
                                                <th>Select Seat</th>
                                                <th>Operation</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <!--This is an empty table body-->
                                            <tr v-for="(item,index) in searchRoutes">
                                                <td> {{index}}</td>
                                                <td class='booking_tripId'>
                                                    {{item.tripId.type}}{{item.tripId.number }}
                                                </td>
                                                <td class='booking_trainTypeId'> {{item.trainTypeId}}
                                                </td>
                                                <td class='booking_from'> {{item.startStation}}</td>
                                                <td class='booking_to'>{{item.terminalStation}}</td>
                                                <td>{{item.startTime}}</td>
                                                <td>{{item.endTime}}</td>
                                                <td>{{item.economyClass}}</td>
                                                <td>{{item.confortClass}}</td>
                                                <td>
                                                    <select class='form-control booking_seat_class'
                                                        v-model="selectedSeats[index]" style="min-width: 120px;">
                                                        <option value="2"> 1st - {{item.priceForConfortClass}}</option>
                                                        <option value="3"> 2st - {{item.priceForEconomyClass}}</option>
                                                    </select>
                                                </td>
                                                <td class='booking_seat_price_confort noshow_component'>
                                                    priceForConfortClass
                                                </td>
                                                <td class='booking_seat_price_economy noshow_component'>
                                                    priceForEconomyClass
                                                </td>
                                                <td>
                                                    <button class='btn btn-primary ticket_booking_button'
                                                        v-on:click="reBook(index, item.tripId.type, item.tripId.number)">
                                                        ReBook
                                                    </button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <!--确认改变对话框结束-->
                            </div>
                        </div>
                    </div>


                    <!--change  pay-->
                    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt1">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">Pay For Reserve</div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>Old Trip Id:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_OldTripId" class="form-control" name='' v-model="oldTripId"
                                        readonly="readonly"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>New Trip Id:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_newTripId" class="form-control" name='' v-model="newTripId"
                                        readonly="readonly"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>Date:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7">
                                    <input id="re_booking_dates" class="form-control" name='' v-model="dateOfToday"
                                        readonly="dateOfToday"></li>
                                </div>
                            </div>
                            <div class="am-g ticket-from-confirm">
                                <div class="am-form-group am-u-sm-5">
                                    <label>Seat Type:</label>
                                </div>
                                <div class="am-form-group am-u-sm-7" v-if="selectSeatOptions == '2'">
                                    <input class="form-control" name='' readonly="readonly" value="confort seat"></li>
                                </div>
                                <div class="am-form-group am-u-sm-7" v-if="selectSeatOptions == '3'">
                                    <input class="form-control" name='' readonly="readonly" value="economy seat"></li>
                                </div>
                            </div>


                            <div class="am-modal-footer">
                                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                <span class="am-modal-btn" id="pay_for_preserve1" data-am-modal-confirm>提交</span>
                            </div>
                        </div>
                    </div>


                    <!--pay for the difference-->

                    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt2">
                        <div class="am-modal-dialog">
                            <div class="am-modal-hd">pay for difference money</div>
                            <div class="am-modal-bd">
                                <input type="text" class="am-modal-prompt-input" readonly="readonly"
                                    v-model="differenceMoney">
                            </div>
                            <div class="am-modal-footer">
                                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                                <span class="am-modal-btn" data-am-modal-confirm>提交</span>
                            </div>
                        </div>
                    </div>


                </div>
                <div class="tpl-alert"></div>
            </div>
        </div>
    </div>

    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/app.js"></script>
</body>

</html>