<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description"
          content="Cuba admin is super flexible, powerful, clean &amp; modern responsive bootstrap 5 admin template with unlimited possibilities.">
    <meta name="keywords"
          content="admin template, Cuba admin template, dashboard template, flat admin template, responsive admin template, web app">
    <meta name="author" content="pixelstrap">
    <link rel="icon" href="/RTL/superAdmin/images/favicon.png" type="image/x-icon">
    <link rel="shortcut icon" href="/RTL/superAdmin/images/favicon.png" type="image/x-icon">
    <title>آنسه تیم</title>
    <!-- Google font-->

    <script src="https://cdn.ckeditor.com/ckeditor5/35.0.1/classic/ckeditor.js"></script>

    <link href="https://fonts.googleapis.com/css?family=Rubik:400,400i,500,500i,700,700i&amp;display=swap"
          rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,500,500i,700,700i,900&amp;display=swap"
          rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/font-awesome.css">
    <!-- ico-font-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/icofont.css">
    <!-- Themify icon-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/themify.css">
    <!-- Flag icon-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/flag-icon.css">
    <!-- Feather icon-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/feather-icon.css">
    <!-- Plugins css start-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/scrollbar.css">
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/prism.css">
    <!-- Plugins css Ends-->
    <!-- Bootstrap css-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/bootstrap.css">
    <!-- App css-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/style.css">
    <link id="color" rel="stylesheet" href="/RTL/superAdmin/css/color-1.css" media="screen">
    <!-- Responsive css-->
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/responsive.css">
    <link rel="stylesheet" type="text/css" href="/RTL/superAdmin/css/vendors/select2.css">
</head>
<body class="rtl">
<!-- tap on top starts-->
<div class="tap-top"><i data-feather="chevrons-up"></i></div>
<!-- tap on tap ends-->
<!-- page-wrapper Start-->
<div class="page-wrapper compact-wrapper" id="pageWrapper">
    <!-- Page Header Start-->

    <%- include('../../../partials/header') %>

    <!-- Page Sidebar Ends-->
    <div class="page-body">
        <div class="container-fluid">
            <div class="page-title">
                <div class="row">
                    <div class="col-12">
                        <ol class="breadcrumb" style="-webkit-box-pack: start!important;">
                            <li class="breadcrumb-item"><a href="/<%= lan.ShortName %>/dashboard"><i
                                            data-feather="home"></i></a></li>
                            <li class="breadcrumb-item">تامین کننده ها</li>
                            <li class="breadcrumb-item">کالاها ها</li>
                            <li class="breadcrumb-item active">لیست تنوع ها</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <!-- Container-fluid starts-->
        <!-- Container-fluid starts-->
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12 col-xl-12">
                    <div class="row">
                        <div class="col-sm-10" style="margin:0 auto">

                            <div class="card">
                                <div class="card-header">
                                    <h5>ثبت تنوع در سامانه آنسه تیم</h5>
                                </div>

                                <div class="card-body">
                                    <form class="form-space theme-form row"
                                          action="/<%= lan.ShortName %>/productPrice/add/<%= vendor._id %>/<%= product._id %>"
                                          method="post">

                                        <label class="form-label"> نوع تنوع </label>
                                        <div>
                                            <% if(productTypePrice.Color == true){ %>
                                                <div>
                                                    <input type="checkbox" class="form-check-input" name="ChooseColor"
                                                           id="ChooseColor" value="true">
                                                    <label class="form-label">رنگ</label>
                                                </div>
                                            <% } %>
                                            <% if(productTypePrice.Size == true){ %>
                                                <div>
                                                    <input type="checkbox" class="form-check-input" name="ChooseSize"
                                                           id="ChooseSize" value="true">
                                                    <label class="form-label">سایز</label>
                                                </div>
                                            <% } %>
                                            <% if(productTypePrice.Guarantee == true){ %>
                                                <div>
                                                    <input type="checkbox" class="form-check-input"
                                                           name="ChooseGuarantee" id="ChooseGuarantee" value="true">
                                                    <label class="form-label">گارانتی</label>
                                                </div>
                                            <% } %>
                                        </div>

                                        <div class="col-sm-6">
                                            <div class="col-form-label">رنگ</div>
                                            <select name="Color" id="Color" class="form-control" required disabled>
                                                <% for (var i = 0; i < colors.length; i++) { %>
                                                    <% if(colors[i].Default == true) { %>
                                                        <option value="<%= colors[i]._id %>"
                                                                selected><%= colors[i].ColorDocument.Name %></option>
                                                    <% } else { %>
                                                        <option value="<%= colors[i]._id %>"><%= colors[i].ColorDocument.Name %></option>
                                                    <% } %>
                                                <% } %>
                                            </select>
                                        </div>

                                        <div class="col-sm-6">
                                            <div class="col-form-label">سایز</div>
                                            <select name="Size" id="Size" class="form-control" required disabled>
                                                <% for (var i = 0; i < sizes.length; i++) { %>
                                                    <% if(sizes[i].Default == true) { %>
                                                        <option value="<%= sizes[i]._id %>"
                                                                selected><%= sizes[i].SizeDocument.Name %></option>
                                                    <% } else { %>
                                                        <option value="<%= sizes[i]._id %>"><%= sizes[i].SizeDocument.Name %></option>
                                                    <% } %>
                                                <% } %>
                                            </select>
                                        </div>

                                        <div class="col-sm-6">
                                            <div class="col-form-label">گارانتی</div>
                                            <select name="Guarantee" id="Guarantee" class="form-control" required
                                                    disabled>
                                                <% for (var i = 0; i < guarantees.length; i++) { %>
                                                    <% if(guarantees[i].Default == true) { %>
                                                        <option value="<%= guarantees[i]._id %>"
                                                                selected><%= guarantees[i].GuaranteeDocument.Name %></option>
                                                    <% } else { %>
                                                        <option value="<%= guarantees[i]._id %>"><%= guarantees[i].GuaranteeDocument.Name %></option>
                                                    <% } %>
                                                <% } %>
                                            </select>
                                        </div>

                                        <div class="col-sm-6 d-none">
                                            <div class="col-form-label">فعال برای فروش</div>
                                            <select name="Active" id="Active" class="form-control"
                                                    required>
                                                <option value="true">فعال</option>
                                                <option value="false">غیرفعال</option>
                                            </select>
                                        </div>

                                        <div class="col-sm-6">
                                            <label class="form-label" for="">کد تامین کننده</label>
                                            <input type="text" class="form-control" id="VendorCode" name="VendorCode"
                                                   placeholder="کد تامین کننده">
                                        </div>

                                        <div class="col-sm-6">
                                            <label class="form-label" for="Rate">تعداد در انبار</label>
                                            <input type="number" class="form-control" min="1" value="1" id="Number"
                                                   name="Number"
                                                   placeholder="تعداد در انبار">
                                        </div>

                                        <div class="col-sm-6">
                                            <label class="form-label" for="Rate">حداکثر تعداد قابل سفارش در هر
                                                خرید</label>
                                            <input type="number" class="form-control" min="1" value="1"
                                                   id="MaxNumberOfOrder" name="MaxNumberOfOrder"
                                                   placeholder="حداکثر تعداد قابل سفارش در هر خرید">
                                        </div>

                                        <div class="col-sm-6">
                                            <label class="form-label" for="Rate">حداقل تعداد قابل سفارش در هر
                                                خرید</label>
                                            <input type="number" class="form-control" min="1" value="1"
                                                   id="MinNumberOfOrder" name="MinNumberOfOrder"
                                                   placeholder="حداقل تعداد قابل سفارش در هر خرید">
                                        </div>

                                        <div class="mb-3">
                                            <label class="form-label" for="Caption">توضیحات </label>
                                            <textarea class="form-control" id="Caption" name="Caption"
                                                      placeholder="توضیحات را وارد کنید"></textarea>
                                        </div>

                                        <fieldset>
                                            <legend>جزئیات ارسال</legend>

                                            <div class="col-sm-6">
                                                <div class="col-form-label">نوع ارسال</div>
                                                <select name="TransportType" id="TransportType" class="form-control"
                                                        required>
                                                    <option value="Internal">ارسال توسط آنسه</option>
                                                    <option value="Vendor">ارسال توسط تامین کننده</option>
                                                </select>
                                            </div>

                                            <div class="col-sm-6 d-none">
                                                <label class="form-label" for="">زمان ارسال کالا به انبار آنسه
                                                    (روز) </label>
                                                <input type="number" class="form-control" id="VendorTransportDayTime"
                                                       name="VendorTransportDayTime" min="1" value="1"
                                                       placeholder="زمان ارسال کالا به انبار آنسه">
                                            </div>

                                            <div class="col-sm-6 d-none">
                                                <label class="form-label" for="">زمان ارسال کالا (روز) </label>
                                                <input type="number" class="form-control" id="TransportDayTime"
                                                       name="TransportDayTime" min="0" value="0"
                                                       placeholder="زمان ارسال کالا ">
                                            </div>

                                            <div class="col-sm-6 d-none">
                                                <label class="form-label" for="">زمان ارسال کالا (دقیقه) </label>
                                                <input type="number" class="form-control" id="TransportMinuteTime"
                                                       name="TransportMinuteTime" min="1" value="1"
                                                       placeholder="زمان ارسال کالا ">
                                            </div>

                                        </fieldset>

                                        <fieldset>
                                            <legend>قیمت گذاری</legend>

                                            <div class="col-sm-6">
                                                <div class="col-form-label">ارز</div>
                                                <select name="Currency" id="Currency" class="form-control"
                                                        required>
                                                    <% for (var i = 0; i < currencies.length; i++) { %>
                                                        <option value="<%= currencies[i]._id %>"><%= currencies[i].ShortName %></option>
                                                    <% } %>
                                                </select>
                                            </div>

                                            <div class="col-sm-6">
                                                <label class="form-label" for="">قیمت</label>
                                                <input type="number" class="form-control" id="Price" name="Price"
                                                       min="1" value="1"
                                                       placeholder="قیمت" required>
                                            </div>

                                        </fieldset>

                                        <div class="card-footer text-end">
                                            <button class="btn btn-primary" type="submit">ثبت</button>
                                            <a href="/<%= lan.ShortName %>/vendor/product/<%= vendor._id %>"
                                               class="btn btn-secondary">بازگشت</a>
                                        </div>
                                    </form>

                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-header">
                            <h5>مشاهده لیست تنوع ها آنسه تیم </h5>
                        </div>
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                <tr class="border-bottom-primary" style="text-align:center">
                                    <th scope="col"></th>
                                    <th scope="col">نام کالا</th>
                                    <th scope="col">رنگ</th>
                                    <th scope="col">سایز</th>
                                    <th scope="col">گارانتی</th>
                                    <th scope="col">تعداد</th>
                                    <th scope="col">قیمت</th>
                                    <th scope="col">فعال برای خرید</th>
                                    <th scope="col">مدیریت قیمت</th>
                                    <th scope="col">دیدگاه ها</th>
                                    <th scope="col">ویرایش جزئیات ارسال</th>
                                    <th scope="col">برچسب ها</th>
                                    <th scope="col">ویرایش</th>
                                    <th scope="col">حذف</th>
                                </tr>
                                </thead>
                                <tbody>

                                <% for (var i = 0; i < productPrices.length; i++) { %>
                                    <tr class="border-bottom-info" style="text-align:center">
                                        <th scope="row"><%= i + 1 %></th>
                                        <td><%= productPrices[i].Product.Name %></td>
                                        <% if(productPrices[i].Color) { %>
                                            <td>
                                                <span style="background-color: <%= productPrices[i].Color.Code %>; background-clip: content-box; display: inline-block; width: 15px; height: 10px; padding-left: 5px"></span><%= productPrices[i].Color.Name %>
                                            </td>
                                        <% } else { %>
                                            <td>بدون رنگ</td>
                                        <% } %>
                                        <% if(productPrices[i].Size) { %>
                                            <td><%= productPrices[i].Size.Name %></td>
                                        <% } else { %>
                                            <td>بدون سایز</td>
                                        <% } %>
                                        <% if(productPrices[i].Guarantee) { %>
                                            <td><%= productPrices[i].Guarantee.Name %></td>
                                        <% } else { %>
                                            <td>بدون گارانتی</td>
                                        <% } %>
                                        <td><%= productPrices[i].Number %></td>
                                        <td><%= productPrices[i].LastPrices[0].Price %></td>
                                        <% if(productPrices[i].Active == true) { %>
                                            <td>
                                                <a href="/<%= lan.ShortName %>/productPrice/active/<%= productPrices[i]._id %>"
                                                   class="btn btn-square btn-info-gradien"><i
                                                            class="fa fa-check"></i></a></td>
                                        <% } else { %>
                                            <td>
                                                <a href="/<%= lan.ShortName %>/productPrice/active/<%= productPrices[i]._id %>"
                                                   class="btn btn-square btn-warning-gradien"><i
                                                            class="fa fa-xmark"></i></a></td>
                                        <% } %>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/price/list/productprice/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-success-gradien"><i
                                                        class="fa fa-solid fa-money"></i></a></td>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/viewpoint/list/productprice/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-dark-gradien"><i
                                                        class="fa fa-solid fa-comment"></i></a></td>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/transportDetail/edit/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-info-gradien"><i class="fa fa-send"></i></a>
                                        </td>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/label/list/productprice/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-dark-gradien"><i
                                                        class="fa fa-solid fa-tags"></i></a>
                                        </td>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/productPrice/edit/<%= vendor._id %>/<%= product._id %>/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-primary-gradien"><i class="fa fa-edit"></i></a>
                                        </td>
                                        <td>
                                            <a href="/<%= lan.ShortName %>/productPrice/remove/<%= productPrices[i]._id %>"
                                               class="btn btn-square btn-danger-gradien"><i
                                                        class="fa fa-trash-o"></i></a></td>
                                    </tr>
                                <% } %>
                                </tbody>
                            </table>

                            <nav aria-label="...">
                                <ul class="pagination pagination-primary m-3">
                                    <li class="page-item"><a class="page-link" href="javascript:void(0)">بعدی</a></li>
                                    <li class="page-item"><a class="page-link" href="javascript:void(0)">3</a></li>
                                    <li class="page-item "><a class="page-link" href="javascript:void(0)">2 <span
                                                    class="sr-only">(current)</span></a></li>
                                    <li class="page-item active"><a class="page-link" href="javascript:void(0)">1</a>
                                    </li>
                                    <li class="page-item disabled"><a class="page-link" href="javascript:void(0)"
                                                                      tabindex="-1">قبلی</a></li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>

            </div>

        </div>
        <!-- Container-fluid Ends-->

        <!-- Container-fluid Ends-->
    </div>

    <%- include("../../../partials/footer") %>
</div>
</div>
<!-- latest jquery-->
<script src="/RTL/superAdmin/js/jquery-3.5.1.min.js"></script>
<!-- Bootstrap js-->
<script src="/RTL/superAdmin/js/bootstrap/bootstrap.bundle.min.js"></script>
<!-- feather icon js-->
<script src="/RTL/superAdmin/js/icons/feather-icon/feather.min.js"></script>
<script src="/RTL/superAdmin/js/icons/feather-icon/feather-icon.js"></script>
<!-- scrollbar js-->
<script src="/RTL/superAdmin/js/scrollbar/simplebar.js"></script>
<script src="/RTL/superAdmin/js/scrollbar/custom.js"></script>
<!-- Sidebar jquery-->
<script src="/RTL/superAdmin/js/config.js"></script>
<!-- Plugins JS start-->
<script src="/RTL/superAdmin/js/sidebar-menu.js"></script>
<script src="/RTL/superAdmin/js/prism/prism.min.js"></script>
<script src="/RTL/superAdmin/js/clipboard/clipboard.min.js"></script>
<script src="/RTL/superAdmin/js/custom-card/custom-card.js"></script>
<script src="/RTL/superAdmin/js/tooltip-init.js"></script>
<!-- Plugins JS Ends-->
<!-- Theme js-->
<script src="/RTL/superAdmin/js/script.js"></script>
<!-- login js-->
<!--error message for inputs-->
<script src="/RTL/superAdmin/js/input-error.js"></script>
<script src="/RTL/superAdmin/js/tiny/tinymce.min.js"></script>
<!-- Plugin used-->
<script src="/RTL/superAdmin/js/select2/select2.full.min.js"></script>
<script src="/RTL/superAdmin/js/select2/select2-custom.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js"></script>
<!-- script pop up -->
<script src="/RTL/superAdmin/js/anse/albumPopup.js"></script>

<script>
    window.onload = function () {
        var transportType = $("#TransportType").val()
        if (transportType == "Internal") {
            $("#VendorTransportDayTime").parent().removeClass("d-none")
            $("#TransportDayTime").parent().addClass("d-none")
            $("#TransportMinuteTime").parent().addClass("d-none")
        } else {
            $("#VendorTransportDayTime").parent().addClass("d-none")
            $("#TransportDayTime").parent().removeClass("d-none")
            $("#TransportMinuteTime").parent().removeClass("d-none")
        }
    }
</script>

<script>
    $("#ChooseColor").change(function () {
        console.log("hi")
        var ischecked = $(this).is(':checked');
        if (ischecked) {
            console.log("has")
            $("#Color").parent().removeClass("d-none")
        } else {
            console.log("has not")
            $("#Color").parent().addClass("d-none")
        }
    })

    $("#ChooseSize").change(function () {
        console.log("hi")
        var ischecked = $(this).is(':checked');
        if (ischecked) {
            console.log("has")
            $("#Size").parent().removeClass("d-none")
        } else {
            console.log("has not")
            $("#Size").parent().addClass("d-none")
        }
    })

    $("#ChooseGuarantee").change(function () {
        console.log("hi")
        var ischecked = $(this).is(':checked');
        if (ischecked) {
            console.log("has")
            $("#Guarantee").parent().removeClass("d-none")
        } else {
            console.log("has not")
            $("#Guarantee").parent().addClass("d-none")
        }
    })

    $("#TransportType").change(function () {
        var transportType = $("#TransportType").val()
        if (transportType == "Internal") {
            $("#VendorTransportDayTime").parent().removeClass("d-none")
            $("#TransportDayTime").parent().addClass("d-none")
            $("#TransportMinuteTime").parent().addClass("d-none")
        } else {
            $("#VendorTransportDayTime").parent().addClass("d-none")
            $("#TransportDayTime").parent().removeClass("d-none")
            $("#TransportMinuteTime").parent().removeClass("d-none")
        }
    })
</script>

</body>
</html>
