Commit ebf83120 authored by Julien Ait azzouzene's avatar Julien Ait azzouzene
Browse files
parents e8e09c61 de266748
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -378,6 +378,7 @@ function validateAllCombination() {
        );

        // console.log(zoneElement);
        if (zoneElement == null) return;
        if (zoneElement.hasChildNodes()) {
            if (
                zoneElement.childElementCount < 2 ||
@@ -386,6 +387,7 @@ function validateAllCombination() {
                zoneElement.style.backgroundColor = "rgb(254 202 202)";
                console.log("taille");
                valid = false;
                return;
            }
            zoneElement.childNodes.forEach((elementB) => {
                if (
@@ -395,6 +397,7 @@ function validateAllCombination() {
                    zoneElement.style.backgroundColor = "rgb(254 202 202)";
                    console.log("PB");
                    valid = false;
                    return;
                }
            });
            let children = zoneElement.childNodes;
@@ -403,9 +406,16 @@ function validateAllCombination() {
                    counterCheck++;
                    zoneElement.style.backgroundColor = "rgb(229 231 235)";
                    valid = true;
                    return;
                }
            }
            for (let i = 0; i < children.length; i++) {
                if (children[i].id.split(",")[1] === "PB" && children.length > 2) {
                    zoneElement.style.backgroundColor = "rgb(254 202 202)";
                    console.log("PB");
                    valid = false;
                    return;
                }
                let targetItemsSplit = children[i].id.split(",")[2];
                for (targetItemsSplit in validatePalanqueCombinate) {
                    for (let j = 0; j < children.length; j++) {
@@ -419,11 +429,13 @@ function validateAllCombination() {
                            zoneElement.style.backgroundColor =
                                "rgb(229 231 235)";
                            valid = true;
                            return;
                        }
                    }
                    zoneElement.style.backgroundColor = "rgb(254 202 202)";
                    console.log("combi ", targetItemsSplit);
                    valid = false;
                    return;
                }
            }

@@ -431,24 +443,28 @@ function validateAllCombination() {
            zoneElement.style.backgroundColor = "rgb(229 231 235)";
            console.log("vide");
            valid = false;
            return;
        }
    });
    if (zoneStart.childElementCount == 0 && valid == true) {
        disableVal = false;
    } else {
        disableVal = true;
    }
}

let interval = setInterval(function () {
    updateZoneList();
    validateAllCombination();
    console.log(disableVal);
    disableVal = false;
    document.querySelectorAll("#DropZone > div > div").forEach((element) => {
        if (element.style.backgroundColor === "rgb(254, 202, 202)" || zoneStart.childElementCount > 0) {
            disableVal = true;
            return;
        }
    });
}, 250);

validatePalanque.addEventListener("click", function () {
    if (!disableVal) {
        sendPalanque();
        clearInterval(interval);
        // clearInterval(interval);
    }
});

+19 −4
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ class="w-full py-2.5 px-4 text-sm bg-gray-300 rounded-md focus:outline-none focu
                        @endif

                        <td class="px-12 py-4">
                            <div class="Line">
                                @if ($dive->DS_DIVERS_COUNT > 0)
                                    <x-button diveId="dropdownButton-{{ $dive->DS_CODE }}">
                                        <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true"
@@ -143,7 +144,8 @@ class="w-full py-2.5 px-4 text-sm bg-gray-300 rounded-md focus:outline-none focu
                                @else
                                    <x-button>
                                        <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true"
                                        xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 18">
                                            xmlns="http://www.w3.org/2000/svg" fill="currentColor"
                                            viewBox="0 0 20 18">
                                            <path
                                                d="M14 2a3.963 3.963 0 0 0-1.4.267 6.439 6.439 0 0 1-1.331 6.638A4 4 0 1 0 14 2Zm1 9h-1.264A6.957 6.957 0 0 1 15 15v2a2.97 2.97 0 0 1-.184 1H19a1 1 0 0 0 1-1v-1a5.006 5.006 0 0 0-5-5ZM6.5 9a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM8 10H5a5.006 5.006 0 0 0-5 5v2a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-2a5.006 5.006 0 0 0-5-5Z" />
                                        </svg>
@@ -153,9 +155,11 @@ class="w-full py-2.5 px-4 text-sm bg-gray-300 rounded-md focus:outline-none focu
                                    <a href='/unsubscribe/{{ $dive->DS_CODE }}'>
                                        <x-button color="bg-red-700" colorHover="hover:bg-red-800">
                                            <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true"
                                            xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16">
                                                xmlns="http://www.w3.org/2000/svg" fill="none"
                                                viewBox="0 0 16 16">
                                                <path stroke="currentColor" stroke-linecap="round"
                                                stroke-linejoin="round" stroke-width="2" d="M3 3l10 10M13 3L3 13" />
                                                    stroke-linejoin="round" stroke-width="2"
                                                    d="M3 3l10 10M13 3L3 13" />
                                            </svg>
                                        </x-button>
                                    </a>
@@ -172,7 +176,18 @@ class="clickableGreen aligne m-1 bg-gray-400 hover:bg-gray-500
                                    @endif
                                @endif
                                </a>

                                @if ($userPre->PRE_MAX_DEPTH <= $dive->DS_MAX_DEPTH)
                                    <a href="/dives/{{ $dive->DS_CODE }}">
                                        <button disabled diveId="dropdownButton-{{ $dive->DS_CODE }}"
                                            style="background-color: #4fad67;margin-right: 5px;font-size: 35px;"
                                            class="aligne m-1 bg-gray-400 hover:bg-gray-500
                                            text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center">
                                            <i class="fa-solid fa-check"></i>
                                        </button>
                                    </a>
                                @endif
                            </div>
                        </td>

    </div>