<!DOCTYPE html>
<html lang="en">
  
<head>
    <%- include('./partials/head'); -%>
    
</head>
<body onload="startTime()">
    <%- include('./partials/header_sidebar'); -%>
    
    <!-- tap on top starts-->

        <!-- Page Sidebar Ends-->
        <div class="page-body">
          <div class="container-fluid">
            <div class="page-title">
              <div class="row">
                <div class="col-sm-6">
                  <h3> <%=lan.edit%> <%=lan.outstation%></h3>
                </div>
                <div class="col-sm-6">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/index"><i data-feather="home"></i></a></li>
                    <li class="breadcrumb-item"><%=lan.dashboard%></li>
                    <li class="breadcrumb-item active"><%=lan.outstation%></li>
                    <li class="breadcrumb-item active"><%=lan.edit%> <%=lan.outstation%></li>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
              <div class="col-sm-12">
                <div class="card">
                  <div class="card-body">
                    <form  class="needs-validation" novalidate="" action="/outstation/edit_outstation/<%=oustation.id%>" method="post" enctype="multipart/form-data">
                      <div class="row">

                        <div class="col-12">
                            <div class="text-center form-group">
                                <% if(oustation.image == null) { %>
                                    <img id="file-preview" width="150" height="150" src="../images/dashboard/default/profile.png" alt="<%=lan.image_preview%>">
                                <% } else { %>
                                    <img id="file-preview" width="150" height="150" src="../../<%=oustation.image%>" alt="<%=lan.image_preview%>">
                                <% }; %>
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                            <label class="col-form-label"><%=lan.image%></label>
                            <input class="form-control" style="height: 47px;" type="file" name="image" onchange="showPreview(event)">
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                          <label class="col-form-label"><%=lan.name%></label>
                          <input class="form-control" type="text" name="name" value="<%=oustation.name%>" placeholder="<%=lan.enter_name%>" required>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                          <label class="col-form-label"><%=lan.min_km%> <%=lan.distance%></label><i class="fa fa-info-circle f-16 mt-2 m-l-5" data-bs-toggle="tooltip" data-bs-placement="Top" title="<%=lan.category_min_km_distance%>"></i>
                          <input class="form-control" type="number" step="any" name="min_km_distance" value="<%=oustation.min_km_distance%>" placeholder="<%=lan.enter_min_km_distance%>" required>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                          <label class="col-form-label"><%=lan.min_km%> <%=lan.price%></label><i class="fa fa-info-circle f-16 mt-2 m-l-5" data-bs-toggle="tooltip" data-bs-placement="Top" title="<%=lan.category_min_km_price%>"></i>
                          <input class="form-control" type="number" step="any" name="min_km_price" value="<%=oustation.min_km_price%>" placeholder="<%=lan.enter_min_km_price%>" required>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                          <label class="col-form-label"><%=lan.after_km%> <%=lan.price%></label><i class="fa fa-info-circle f-16 mt-2 m-l-5" data-bs-toggle="tooltip" data-bs-placement="Top" title="<%=lan.category_after_km_price%>"></i>
                          <input class="form-control" type="number" step="any" name="after_km_price" value="<%=oustation.after_km_price%>" placeholder="<%=lan.enter_after_km_price%>" required>
                        </div>

                        <div class="col-12">
                            <div class="row">
                                <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                                    <label class="col-form-label"><%=lan.today%></label>
                                    <input class="form-control" type="number" step="any" name="today_price" value="<%=oustation.today_price%>" placeholder="<%=lan.enter_today_price%>" required>
                                </div>
          
                                <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                                    <label class="col-form-label"><%=lan.tomorrow%></label>
                                    <input class="form-control" type="number" step="any" name="tomorrow_price" value="<%=oustation.tomorrow_price%>" placeholder="<%=lan.enter_tomorrow_price%>" required>
                                </div>
          
                                <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4 form-group">
                                    <label class="col-form-label"><%=lan.day_after_tomorrow%></label>
                                    <input class="form-control" type="number" step="any" name="day_after_price" value="<%=oustation.day_after_price%>" placeholder="<%=lan.enter_day_after_tomorrow_price%>" required>
                                </div>
                            </div>
                        </div>


                        <div class=" col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                            <div class="row">
                                <label class="col-form-label"><%=lan.commission%> <%=lan.rate%></label>
                                <div class="col-sm-6 col-md-8 col-lg-8 col-xl-8">
                                    <input class="form-control" type="number" step="any" name="comission_rate" value="<%=oustation.comission_rate%>" placeholder="<%=lan.enter_commission_rate%>" required>
                                </div>
                                <div class="col-sm-6 col-md-4 col-lg-4 col-xl-4 d-flex">
                                    <div class="col-4">
                                        <input class="form-control" type="text" placeholder="<%=lan.fix%>" readonly>
                                    </div>
                                    <div class="col-4 text-center">
                                        <div class="icon-state switch-outline" style="padding-top: 6px;">
                                            <label class="switch">
                                                <input type="checkbox" name="comission_type" <%= oustation.comission_type == '%' ? 'checked' : '' %>><span class="switch-state bg-success"></span>
                                            </label>
                                        </div>
                                    </div>
                                    <div class="col-4">
                                        <input class="form-control" type="text" placeholder="%" readonly>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                            <label class="col-form-label"><%=lan.extra_charge%></label>
                            <input class="form-control" type="number" step="any" name="extra_charge" value="<%=oustation.extra_charge%>" placeholder="<%=lan.enter_extra_charge%>" required>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                            <label class="col-form-label"><%=lan.outstation_category_list%></label>
                            <select class="js-example-basic-single" name="outstation_category" required>
                                <option value selected disabled><%=lan.outstation_category_list_placeholder%></option>
                                <% outstation_category.forEach((data) => { %>
                                    <option value="<%= data.id %>" <%= oustation.outstation_category == data.id ? 'selected' : "" %>><%= data.title %></option>
                                <% }) %>
                            </select>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6">
                            <div class="row">
                                <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                    <label class="col-form-label"><%=lan.number_of_passenger%></label>
                                    <input class="form-control" type="number" step="any" name="tot_passenger"  value="<%=oustation.tot_passenger%>" placeholder="<%=lan.enter_number_of_passenger%>">
                                </div>
                                <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                                    <label class="col-form-label"><%=lan.per_person_price%></label>
                                    <input class="form-control" type="number" step="any" name="per_person_price"  value="<%=oustation.per_person_price%>" placeholder="<%=lan.enter_per_person_price%>">
                                </div>
                            </div>
                        </div>

                        <div class="col-sm-12 col-md-6 col-lg-6 col-xl-6 form-group">
                            <label class="col-form-label"><%=lan.vehicle_list%></label>
                            <select class="js-example-placeholder-multiple col-sm-12" name="vehicle" multiple="multiple">
                                <% vehicle_list.forEach((data) => { %>
                                    <% if (vehicle.includes(data.id) == true) { %>
                                        <option value="<%= data.id %>" selected><%= data.name %></option>
                                    <% } else { %>
                                        <option value="<%= data.id %>"><%= data.name %></option>
                                    <% }; %>
                                <% }) %>
                            </select>
                        </div>

                        <div class="col-12 mt-1">
                          <div class="row">
                            <div class="col-sm-12 col-md-6 col-lg-4 col-xl-4">
                              <div class="d-flex mb-2">
                                <div class="icon-state switch-outline">
                                  <label class="switch">
                                    <input type="checkbox" name="bidding" id="bidding_status_check" <%= oustation.bidding == 1 ? 'checked' : '' %>><span class="switch-state bg-success"></span>
                                  </label>
                                </div>
                                <label class="col-form-label m-l-10"><%=lan.set_preferred_price%> / <%=lan.bidding_system%></label>
                              </div>
                            </div>
                            <div class="col-sm-12 col-md-6 col-lg-3 col-xl-3 <%= oustation.bidding == 1 ? '' : 'd-none' %>" id="minfare">
                              <label class="col-form-label"><%=lan.minimum_fare%></label>
                              <input class="form-control" id="minfarein" type="number" step="any" name="minimum_fare" value="<%=oustation.minimum_fare%>" placeholder="<%=lan.enter_minimum_fare%>" <%= oustation.bidding == 1 ? "required" : '' %>>
                            </div>
                            <div class="col-sm-12 col-md-6 col-lg-3 col-xl-3 <%= oustation.bidding == 1 ? '' : 'd-none' %>" id="maxfare">
                              <label class="col-form-label"><%=lan.maximum_fare%></label>
                              <input class="form-control" id="maxfarein" type="number" step="any" name="maximum_fare" value="<%=oustation.maximum_fare%>" placeholder="<%=lan.enter_maximum_fare%>" <%= oustation.bidding == 1 ? "required" : '' %>>
                            </div>
                          </div>
                        </div>

                        <div class="col-12">
                          <div class="d-flex mb-2">
                            <div class="icon-state switch-outline">
                              <label class="switch">
                                <input type="checkbox" name="whether_charge" <%= oustation.whether_charge == '1' ? 'checked' : '' %>><span class="switch-state bg-success"></span>
                              </label>
                            </div>
                            <label class="col-form-label m-l-10"><%=lan.weather_bad%></label><i class="fa fa-info-circle f-16 mt-2 m-l-5" data-bs-toggle="tooltip" data-bs-placement="Top" title="<%=lan.category_weather_bad%>"></i>
                          </div>
                        </div>

                        <div class="col-12">
                          <div class="d-flex mb-2">
                            <div class="icon-state switch-outline">
                              <label class="switch">
                                <input type="checkbox" name="status" <%= oustation.status == '1' ? 'checked' : '' %>><span class="switch-state bg-success"></span>
                              </label>
                            </div>
                            <label class="col-form-label m-l-10"><%=lan.status%></label>
                          </div>
                        </div>
                        
                        </div>
                        <div class="text-end mt-5">
                          <button class="btn btn-square btn-primary btn-air-primary add_detail_btn b-r-10" id="socketchange" type="submit"><%=lan.submit%></button> 
                        </div>
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>

        <%- include('./partials/footer'); -%>
        <%- include('./partials/script'); -%>
        <script src="/socket.io/socket.io.js"></script>
        <script src="../../socket_function.js"></script>
  </body>
</html>
