<?php
include 'includ/header.php';
?>
        <div class="container grid px-6 mx-auto ">

            <a style="font-size: 20px"
               class="text-xs font-semibold tracking-wide text-left text-gray-500 0 dark:text-gray-400 inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"
            >
                <svg xmlns="http://www.w3.org/2000/svg" fill="gray" xmlns:xlink="http://www.w3.org/1999/xlink"
                     version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512"
                     style="enable-background:new 0 0 512 512;" xml:space="preserve" width="21" height="21"><g>
                        <path d="M480,224H288V32c0-17.673-14.327-32-32-32s-32,14.327-32,32v192H32c-17.673,0-32,14.327-32,32s14.327,32,32,32h192v192   c0,17.673,14.327,32,32,32s32-14.327,32-32V288h192c17.673,0,32-14.327,32-32S497.673,224,480,224z"/>
                    </g></svg>
                <span class="ml-4"><?php echo $_LANG['Addvolume']?></span>
                <?php session_notif_wizwiz() ?>
            </a>

            <section  style='margin-top:40px'  class="w-full p-6 mx-auto bg-white rounded-md shadow-sm dark:bg-gray-800">
                <form id="insert_volume_gb">
                    <?php
                    $handler = new VolumeInsertionHandler($conn);
                    $handler->handleInsertion();
                    ?>
                    <div class="grid grid-cols-1 gap-6 mt-4 xl:grid-cols-2 lg:grid-cols-2 md:grid-cols-2 sm:grid-cols-1 text-left">
                        <div class="mt-2">
                            <label class="text-gray-700 dark:text-gray-200 mt-2" for="volume_save"><?php echo $_LANG['volume_save']?></label>
                            <input required name="volume_save" id="volume_save" type="text"
                                   class="block w-full px-4 py-2 mt-2 text-gray-700 bg-white border border-gray-200 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring">
                        </div>
                        <div class="mt-2">
                            <label class="text-gray-700 dark:text-gray-200 mt-2" for="price_save"><?php echo $_LANG['price']?></label>
                            <input required name="price_save" id="price_save" type="number"
                                   class="block w-full px-4 py-2 mt-2 text-gray-700 bg-white border border-gray-200 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring">
                        </div>
                    </div>

                    <div class="flex justify-end mt-6">
                        <button name="save_volume"  type="submit"
                                class="px-8 py-2.5 leading-5 transition-colors duration-300 transform">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="#b298dc" viewBox="0 0 24 24" width="25"
                                 height="25">
                                <g id="_01_align_center" data-name="01 align center">
                                    <path d="M7.8,20.53a2.99,2.99,0,0,1-2.121-.877L.086,14.061,1.5,12.646l5.593,5.593a1,1,0,0,0,1.414,0L22.5,4.246,23.914,5.66,9.921,19.653A2.99,2.99,0,0,1,7.8,20.53Z"/>
                                </g>
                            </svg>
                        </button>
                    </div>
                </form>

            </section>

            <br>
            <br>

            <section class="w-full p-6 mx-auto bg-white rounded-md shadow-sm dark:bg-gray-800">
                <form id="insert_volume_day">
                    <?php
                    $handler->insertVolumeDay();
                    ?>
                    <div class="grid grid-cols-1 gap-6 mt-4 xl:grid-cols-2 lg:grid-cols-2 md:grid-cols-2 sm:grid-cols-1 text-left">
                        <div class="mt-2">
                            <label class="text-gray-700 dark:text-gray-200 mt-2" for="days_save"><?php echo $_LANG['days_save']?></label>
                            <input required name="days_save" id="days_save" type="text"
                                   class="block w-full px-4 py-2 mt-2 text-gray-700 bg-white border border-gray-200 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring">
                        </div>
                        <div class="mt-2">
                            <label class="text-gray-700 dark:text-gray-200 mt-2" for="price_day_save"><?php echo $_LANG['price']?></label>
                            <input required name="price_day_save" id="price_day_save" type="number"
                                   class="block w-full px-4 py-2 mt-2 text-gray-700 bg-white border border-gray-200 rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-blue-400 focus:ring-blue-300 focus:ring-opacity-40 dark:focus:border-blue-300 focus:outline-none focus:ring">
                        </div>
                    </div>

                    <div class="flex justify-end mt-6">
                        <button name="save_day" type="submit"
                                class="px-8 py-2.5 leading-5 transition-colors duration-300 transform">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="#b298dc" viewBox="0 0 24 24" width="25"
                                 height="25">
                                <g id="_01_align_center" data-name="01 align center">
                                    <path d="M7.8,20.53a2.99,2.99,0,0,1-2.121-.877L.086,14.061,1.5,12.646l5.593,5.593a1,1,0,0,0,1.414,0L22.5,4.246,23.914,5.66,9.921,19.653A2.99,2.99,0,0,1,7.8,20.53Z"/>
                                </g>
                            </svg>
                        </button>
                    </div>
                </form>
            </section>
            <br>
            <br>
            <br>
            <div class="grid gap-6 mb-8 xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-2">



                <?php
                $handler->handleDeletePlanRequest();
                $handler->handleDeleteDayRequest();
                $volume_select_gb = volume_select_gb($conn);
                if (is_array($volume_select_gb) || is_object($volume_select_gb)) {
                    foreach ($volume_select_gb
                             as $value):
                        ?>
                        <div class="shadow-lg rounded-2xl bg-white dark:bg-gray-800 p-4 ">
                            <div class="flex-row gap-8 flex justify-center items-center">
                                <div class=" flex flex-col">
            <span style="font-weight: bold" class="text-lg text-left font-medium text-gray-600 dark:text-white ">
                <?php echo $value['volume']; ?> <?php echo $_LANG['GB']; ?>
            </span>
                                    <span class="text-xs text-gray-700 mt-2 text-left dark:hover:text-gray-200 dark:text-gray-100">
            <p class="" style="font-size: 15px"> Price: <span
                        style="color: #ef233c;"> <?php echo number_format($value['price']) ?> </span></p>
            </span>
                                </div>
                                <a href="add-volume.php?deleteplan=<?php echo $value['id']; ?> " >
                                    <button type="submit" name="delete_category"
                                            style="background-color: #fbe9ed;color:#c6030c;width: 50px"
                                            class="mx-auto py-2 px- text-white w-full transition ease-in duration-200 text-center text-base font-semibold focus:outline-none focus:ring-2 focus:ring-offset-2  rounded-lg ">
                                        <svg style="width: 20px;" class="mx-auto" aria-hidden="true" fill="currentColor"
                                             viewBox="0 0 20 20">
                                            <path fill-rule="evenodd"
                                                  d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z"
                                                  clip-rule="evenodd"></path>
                                        </svg>
                                    </button>
                                </a>
                            </div>
                        </div>
                    <?php
                    endforeach;
                }
                ?>
<!--                <div id="result"></div>-->


                <?php
                $volume_select_day = volume_select_day($conn);
                if (is_array($volume_select_day) || is_object($volume_select_day)) {
                    foreach ($volume_select_day
                             as $value):
                        ?>
                        <div class="shadow-lg rounded-2xl bg-white dark:bg-gray-800 p-4 ">
                                <div class="flex-row gap-8 flex justify-center items-center">
                                    <div class=" flex flex-col">
                                    <span style="font-weight: bold" class="text-lg text-left font-medium text-gray-600 dark:text-white ">
                                        <?php echo $value['volume']; ?> <?php echo $_LANG['Days']; ?>
                                    </span>
                                        <span class="text-xs text-gray-700 mt-2 text-left dark:hover:text-gray-200 dark:text-gray-100">
                        <p class="" style="font-size: 15px">Price:
                            <span style="color: #ef233c;"> <?php echo number_format($value['price']) ?>  </span>
                        </p>
                                    </span>
                                    </div>
                                    <a href="add-volume.php?deleteday=<?php echo $value['id']; ?>">
                                        <button type="button" name="delete_category"
                                                style="background-color: #fbe9ed;color:#c6030c;width: 50px"
                                                class="mx-auto py-2 px- text-white w-full transition ease-in duration-200 text-center text-base font-semibold focus:outline-none focus:ring-2 focus:ring-offset-2  rounded-lg ">
                                            <svg style="width: 20px;" class="mx-auto" aria-hidden="true" fill="currentColor"
                                                 viewBox="0 0 20 20">
                                                <path fill-rule="evenodd"
                                                      d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z"
                                                      clip-rule="evenodd"></path>
                                            </svg>
                                        </button>
                                    </a>
                                </div>
                            </div>
                    <?php
                    endforeach;
                }
                ?>
<?php
include 'includ/footer.php';
?>
