Rimmon пре 3 година
родитељ
комит
46d375d558
1 измењених фајлова са 55 додато и 12 уклоњено
  1. 55 12
      Pages/ModalAssets.razor

+ 55 - 12
Pages/ModalAssets.razor

@@ -54,21 +54,21 @@
                             <button class="btn_orange btn_center">Вывод</button>
                         </div>*@
                 </div>
-                @*<div class="modal__body__container__right">
+                <div class="modal__body__container__right">
                         <p class="modal__body__calc__change__header">Обмен</p>
                         <p class="modal__body__calc__change__desc">Trade tokens in an istant</p>
-                        <div class="modal__input__box" place="From" balanc='0.00000410' currency='ETH'>
-                            <input type="text" class="modal__input">
-                            <select type="select" class="modal__select">
-                                <option>ETH</option>
-                                <option>2DH</option>
+                        <div class="modal__input__box" place="From" balanc=@chosenBalanceFrom>
+                            <input value=@fromInput type="text" class="modal__input">
+                            <select @bind="from_token_selected" type="select" class="modal__select">
+                                <option value="eth">ETH</option>
+                                <option value="hcb">HCB</option>
                             </select>
                         </div>
-                        <div class="modal__input__box" place="To" balanc='0.00000410' currency='2DH'>
-                            <input type="text" class="modal__input">
-                            <select type="select" class="modal__select">
-                                <option>2DH</option>
-                                <option>ETH</option>
+                        <div class="modal__input__box" place="To" balanc=@chosenBalanceTo>
+                            <input value=@toInput  type="text" class="modal__input">
+                            <select @bind="to_token_selected"  type="select" class="modal__select">
+                                <option value="hcb">HCB</option>
+                                <option value="eth">ETH</option>
                             </select>
                         </div>
                         <div class="modal__input__total">
@@ -81,7 +81,7 @@
                         <div class="modal__input__button">
                             <button class="btn_orange btn_center">ОК</button>
                         </div>
-                    </div>*@
+                    </div>
             </div>
         </div>
         <a class="modal_close" style="cursor:pointer" @onclick="@Close">&#10006;</a>
@@ -95,7 +95,50 @@
     public RenderFragment Title { get; set; }
     string ethBalance;
     string tokenBalance;
+    string chosenBalanceFrom;
+    string chosenBalanceTo;
     string bc_selected;
+    string fi;
+    string ti;
+    string fromInput
+    {
+        get { return fi;
+        }
+        set { fi = value;
+            var val = System.Convert.ToSingle(fi);
+            val *= 5;
+            toInput = val.ToString();
+        }
+    }
+
+    string toInput
+    {
+        get { return ti; }
+        set { ti = value; }
+    }
+    string ft;
+    string from_token_selected
+    {
+        get {
+            return ft;
+        }
+        set {
+            if (value == "eth")
+            {
+                to_token_selected = "hcb";
+                chosenBalanceFrom = ethBalance;
+                chosenBalanceTo = tokenBalance;
+            }
+            else
+            {
+                to_token_selected = "eth";
+                chosenBalanceFrom = tokenBalance;
+                chosenBalanceTo = ethBalance;
+            }
+            ft = value;
+        }
+    }
+    string to_token_selected;
 
     string elementid = "modal_assets";