<%- include('partials/header') %> 
<%- include('partials/sidemenu') %> 
<style>
	button.btn.dropdown-toggle.btn-light {
    display: none;
}
.dropdown.bootstrap-select.form-control {
    padding: 0;
}
</style>
        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <div class="container-fluid">
                <div class="page-titles">
					<ol class="breadcrumb">
						<li class="breadcrumb-item"><a href="javascript:void(0)">Edit Transaction</a></li>
						<li class="breadcrumb-item active"><a href="/edit-user/<%=owner._id%>">Back To All Transactions</a></li>
					</ol>
                </div>
                <!-- row -->
                <div class="row">
                    <div class="col-lg-12">
                        <div class="profile card card-body px-3 pt-3 pb-0">
                            <div class="profile-head">
                                <div class="photo-content">
                                    <div class="cover-photo"></div>
                                </div>
                                <div class="profile-info">
									<% if(owner.profileimage.path !== undefined) { %>
										<div class="profile-photo">
											<img src="/<%=owner.profileimage.path%>" class="img-fluid rounded-circle" alt="" style=" width:120px !important; height:120px !important; max-width: unset;">
										</div>
									<%} else{ %>
										<div class="profile-photo" >
											<img src="../images/avatar/profile.png" class="img-fluid rounded-circle" alt="">
										</div>
							     	<%}%>
									
									<div class="profile-details">
										<div class="profile-name px-3 pt-2">
											<h4 class="text-primary mb-0"><%=owner.fullnames.firstname%> <%=owner.fullnames.lastname%></h4>
											<p>Fountain Core User</p>
										</div>
										<div class="profile-email px-2 pt-2">
											<h4 class="text-muted mb-0"><%=owner.username%></h4>
											<p>Email</p>
                                        </div>
                                       
										
									</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                   
                    <div class="col-xl-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="profile-tab">
                                    <div class="custom-tab-1">
                                       
                                        <div class="tab-content">
											
                                            <div id="transactions" class="tab-pane fade show active">
												<h4>Edit Transaction</h4>
                                                <div class="pt-3">
                                                    <div class="settings-form">
                                                        
                                                        <form method="POST" action="/update-user-transaction">
                                                            <div class="form-row">
                                                                <div class="form-group col-md-6">
                                                                    <label>Transaction Type</label>
                                                                        <% let types = ['Credit','Debit'] %>
                                                                
                                                                        <select class="form-control" name="transactiontype">
                                                                            <option selected><%= transaction.type %></option>
                                                                            <% types.forEach(function(type){ %>
                                                                                <% if(type !== transaction.type){ %>
                                                                                    <option><%=type%></option>
                                                                                <% } %>
                                                                            <% }) %>
                                                                           
                                                                        </select>
                                                                     </div>
                                                                <div class="form-group col-md-6">
                                                                    <label>Beneficiary Name</label>
                                                                    <input type="text" class="form-control" name="beneficiaryname" value="<%=transaction.bdetails.bn%>">
                                                                </div>
															</div>
															<div class="form-row">
                                                                <div class="form-group col-md-6">
																	<label>Beneficiary Bank</label>
                                                                    <input type="text" class="form-control" name="beneficiarybankname" value="<%=transaction.bdetails.bbn%>">
                                                                </div>
                                                                <div class="form-group col-md-6">
                                                                    <label>Bneficiary Bank BIC</label>
																	<input type="text" name="beneficiarybankbic" class="form-control" required value="<%=transaction.bdetails.bbic%>">
																	<input type="text" value="<%=transaction._id%>" class="form-control" name="transactionid" hidden>
                                                                </div>
															</div>
															<div class="form-row">
                                                                <div class="form-group col-md-6">
																	<label>Beneficiary Account Number</label>
                                                                    <input type="number" class="form-control" name="beneficiaryaccountnumber" value="<%=transaction.bdetails.ban%>">
                                                                </div>
                                                                <div class="form-group col-md-6">
                                                                    <label>Amount</label>
                                                                    <input type="number" class="form-control" name="amount" value="<%=transaction.amount%>"> 
                                                                </div>
                                                            </div>
                                                            <div class="form-row">
                                                              
                                                                <div class="form-group col-md-6">
                                                                    <label>Date </label>
                                                                    <% if(transaction.admindate == undefined) { %>
                                                                        <input type="text" class="form-control" name="date" value="<%=transaction.date%>">
                                                                    <% } else {%>
                                                                    <input type="date" class="form-control" name="date" value="<%=transaction.admindate%>">
                                                                    <%} %>
                                                                </div>
                                                                <div class="form-group col-md-6">
                                                                    <label>Status</label>
                                                                    <% let status = ['Successful','Pending','Failed'] %>
                                                                
                                                                        <select class="form-control" name="status">
                                                                            <option selected><%= transaction.status %></option>
                                                                            <% status.forEach(function(stat){ %>
                                                                                <% if(stat !== transaction.status){ %>
                                                                                    <option><%=stat%></option>
                                                                                <% } %>
                                                                            <% }) %>
                                                                            
                                                                        </select>
                                                                   
                                                                </div>
                                                            </div>
                                                             <button class="btn btn-primary" type="submit"> Update Transaction                     </button>
                                                            
                                                        </form>
                                                    </div>
                                                </div>
                                               
                                            </div>
                                          
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--**********************************
            Content body end
        ***********************************-->


        <!--**********************************
            Footer start
        ***********************************-->
        <div class="footer">
            <div class="copyright">
                <p>Copyright © 2024 Fountain Core Finance</p>
            </div>
        </div>
        <!--**********************************
            Footer end
        ***********************************-->

        <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->

        
    </div>
    <!--**********************************
        Main wrapper end
    ***********************************-->
	
	<!--removeIf(production)-->
        
    <!--**********************************
        Scripts
    ***********************************-->
    <!-- Required vendors -->
    <script src="/vendor/global/global.min.js"></script>
	<script src="/vendor/bootstrap-select/dist/js/bootstrap-select.min.js"></script>
    <script src="/js/custom.min.js"></script>
	<script src="/js/deznav-init.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
          setTimeout(function(){
            $('#flash').remove();
          }, 5000);
         })
    </script>
	
    



	
		
</body>


</html>