<!DOCTYPE html>
<html ng-app="recoveryApp" lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript" src="bower_components/angular/angular.js"></script>
    <script type="text/javascript" src="bower_components/sjcl/sjcl.js"></script>
    <script type="text/javascript" src="bower_components/bitcore/bitcore.min.js"></script>
    <script type="text/javascript" src="bower_components/bitcore/bitcore.js"></script>
    <script type="text/javascript" src="bower_components/bitcore-mnemonic/bitcore-mnemonic.min.js"></script>
    <script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
    <script type="text/javascript" src="bower_components/ng-lodash/build/ng-lodash.min.js"></script>
    <script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="http://css-spinners.com/css/spinner/hexdots.css" type="text/css">
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="main.css"></link>
    <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script>
    <script type="text/javascript" src="js/services.js"></script>
    <script type="text/javascript" src="js/controllers.js"></script>
    <title>Copay recovery tool</title>
</head>
<div id="wrapper">
    <header class="page-header">
        <div class="container">
            <img src="./img/logo-white.svg" alt="Copay" width="100" style="vertical-align: middle";>
            <span class="label">recovery tool</span>
            <ul class="pull-right">
                <li><a href="https://github.com/bitpay/copay-recovery">View the Code</a></li>
            </ul>
        </div>
    </header>
    <body ng-controller="recoveryController" style="background-color:#F4F6F9">
        <div class="container">
            <div id="sendBlock" style="display: none;">
                <div class="form-group">
                    <label>{{totalBalance}}</label>
                    <div class="input-group">
                        <div class="input-group-addon" >Destination Address :</div>
                        <input type="text" class="form-control" ng-model="addr">
                    </div>
                </div>
                <button class="btn btn-primary" ng-click="sendFunds()">Transfer</button><br><br>
            </div>
            <div id="inputs">
                <h4>Wallet configuration:</h4>
                <div class="row">
                    <div class="col-md-3">
                        <label>Required signatures</label>
                        <select class="pull-right" id="selectM">
                            <option id="1">1</option>
                            <option id="2">2</option>
                            <option id="3">3</option>
                            <option id="4">4</option>
                            <option id="5">5</option>
                            <option id="6">6</option>
                        </select><br>
                        <label>Total Copayers</label>
                        <select class="pull-right" id="selectN">
                            <option id="1">1</option>
                            <option id="2">2</option>
                            <option id="3">3</option>
                            <option id="4">4</option>
                            <option id="5">5</option>
                            <option id="6">6</option>
                        </select><br>
                        <label>Network</label>
                        <select class="pull-right" id="selectNet">
                            <option id="livenet">Livenet</option>
                            <option id="testnet">Testnet</option>
                        </select><br><br>
                    </div>
                </div>
                <div class="form-group" id="block1">
                    <label>Backup for copayer 1:</label>
                    <div class="form-group" id="backup1">
                        <input type="text" class="form-control" ng-model="backUp[1]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile1">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file1" on-read-file="showContent($fileContent, 1)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password1">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[1]">
                    </div>
                    <div class="form-goup" id="passwordX1">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[1]" id="passX1">
                    </div><hr>
                </div>

                <div id="block2" style="display: none">
                    <label>Backup for copayer 2:</label>
                    <br>
                    <div class="form-group" id="backup2">
                        <input type="text" class="form-control" ng-model="backUp[2]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile2">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file2" on-read-file="showContent($fileContent, 2)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password2">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[2]">
                    </div>
                    <div class="form-goup" id="passwordX2">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[2]" id="passX2">
                    </div><hr>
                </div>

                <div id="block3" style="display: none">
                    <label>Backup for copayer 3:</label>
                    <br>
                    <div class="form-group" id="backup3">
                        <input type="text" class="form-control" ng-model="backUp[3]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile3">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file3" on-read-file="showContent($fileContent, 3)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password3">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[3]">
                    </div>
                    <div class="form-goup" id="passwordX3">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[3]" id="passX3">
                    </div><hr>
                </div>

                <div id="block4" style="display: none">
                    <br>
                    <label>Backup for copayer 4:</label>
                    <br>
                    <div class="form-group" id="backup4">
                        <input type="text" class="form-control" ng-model="backUp[4]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile4">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file4" on-read-file="showContent($fileContent, 4)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password4">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[4]">
                    </div>
                    <div class="form-goup" id="passwordX4">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[4]" id="passX4">
                    </div><hr>
                </div>

                <div id="block5" style="display: none">
                    <br>
                    <label>Backup for copayer 5:</label>
                    <br>
                    <div class="form-group" id="backup5">
                        <input type="text" class="form-control" ng-model="backUp[5]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile5">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file5" on-read-file="showContent($fileContent, 5)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password5">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[5]">
                    </div>
                    <div class="form-goup" id="passwordX5">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[5]" id="passX5">
                    </div><hr>
                </div>

                <div id="block6" style="display: none">
                    <br>
                    <label>Backup for copayer 6:</label>
                    <br>
                    <div class="form-group" id="backup6">
                        <input type="text" class="form-control" ng-model="backUp[6]" placeholder="Mnemonic or export wallet data">
                    </div>
                    <div class="form-group" id="backupFile6">
                        <label>Or upload a file: </label>
                        <input type="file" ng-model="file6" on-read-file="showContent($fileContent, 6)" accept="application/json, .txt" style="display: inline">
                    </div>
                    <div class="form-group" id="password6">
                        <label>Password:</label>
                        <input type="password" class="form-control" ng-model="pass[6]">
                    </div>
                    <div class="form-goup" id="passwordX6">
                        <br>
                        <label>Encrypted private key password (in case you have one):</label>
                        <input type="password" class="form-control" ng-model="passX[6]" id="passX6">
                    </div><hr>
                </div>
                <button class="btn btn-primary" ng-click="proccessInputs()">Scan wallet</button><br><br>
            </div>
            <div class="modal fade" id="myModal" data-backdrop="static" data-keyboard="false">
                <div class="modal-dialog" style="position: absolute;display: block;top: 50%;left: 50%;">
                    <!-- Modal content-->
                    <div class="hexdots-loader" ></div>    
                </div>
            </div>

            <div id="successMessage" class="alert alert-success" style="display: none;">
                {{successMessage}}
            </div>
            <div id="errorMessage" class="alert alert-danger" style="display: none;">
                {{errorMessage}}
            </div>
            <div id="statusMessage" class="alert alert-info" style="display: none;">
                {{statusMessage}}
            </div>
        </div>
    </body>
    <footer class="page-footer">
        <div id="back" style="display: none">
            <ul>
                <li><a href="http://bitpay.github.io/copay-recovery/">Back</a></li>
            </ul>
        </div>
    </footer>
</div>
</html>
