Your IP : 18.223.214.17


Current Path : /home/bitrix/ext_www/dev.klimatlend.ua/personal/
Upload File :
Current File : /home/bitrix/ext_www/dev.klimatlend.ua/personal/cab_include.php

<style>
    #elementError{
        display: none !important;
    }
</style>
<div class="main-content">
    <div class="container">
        <div class="row">
            <?//$frame = $this->createFrame()->begin("Загрузка...");?>

            <div class="col-md-3">
                    <?
                    global $USER;
                    $uDBInfo = CUser::GetByID($USER->GetID());
                    if ($uInfo   = $uDBInfo->GetNext())
                    {
                        if ($uInfo['PERSONAL_PHOTO'])
                        {
                            $file = CFile::ResizeImageGet($uInfo['PERSONAL_PHOTO'], array('width' => 270, 'height' => 270), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                        }

                    }
                    ?>
                    <div class="user__photo">
                        <?if(!empty($file[src])){?>
                        <img src="<?= $file[src] ?>" alt="" class="img-responsive">
                        <?}else{?>
                            <img src="<?=SITE_TEMPLATE_PATH?>/img/cabph.png" alt="" class="img-responsive">
                        <?}?>
                        <div id="owner_photo_bubble_wrap">
                            <div id="owner_photo_bubble">
                                <div class="owner_photo_bubble_action owner_photo_bubble_action_update" data-toggle="modal" data-target=".profUpload">
                                    <span class="owner_photo_bubble_action_in">Загрузить новую фотографию</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <script>
                        $(window).bind('load', function () {
                            $('#userPhoto').change(function () {
                                var file = this.files[0];
                                var name = file.name;
                                var size = file.size;
                                var type = file.type;
                                //Your validation
                                var formData = new FormData();
                                formData.append('file', $('#userPhoto')[0].files[0]);
                                $.ajax({
                                    url: ajaxDir + 'upload.php', //Server script to process data
                                    type: 'POST',
                                    xhr: function () {  // Custom XMLHttpRequest
                                        var myXhr = $.ajaxSettings.xhr();
                                        if (myXhr.upload) { // Check if upload property exists
                                            myXhr.upload.addEventListener('progress', progressHandlingFunction, false); // For handling the progress of the upload
                                            document.location.reload();
                                        }
                                        return myXhr;
                                    },
                                    //Ajax events
                                    //beforeSend: $('progress').show(),
                                    //success: document.location.reload(),
                                    //error: alert('Ошибка при загрузке файла!'),
                                    // Form data
                                    data: formData,
                                    //Options to tell jQuery not to process data or worry about content-type.
                                    cache: false,
                                    contentType: false,
                                    processData: false
                                });
                            });
                            function progressHandlingFunction(e) {
                                if (e.lengthComputable) {
                                    $('progress').attr({value: e.loaded, max: e.total});
                                }
                            }
                        });
                    </script>
                    <div class="user__nav">
                       <h5 class="account-menu-title"><a href="/personal/">Личный кабинет</a></h5>
                       <a  class="<?= (CSite::InDir('/personal/order/') ? 'active' : '') ?> mobile_link" href="/personal/order/">Мои заказы</a>
                       <a  class="<?= (CSite::InDir('/personal/fav/') ? 'active' : '') ?>" href="/personal/fav/">Товары в избранном</a>
                       <a data-toggle="modal" data-target=".bs-example-modal-md" href="javascript:void(0)">Личные данные</a>
                       <a href="?logout=yes">Выйти</a>
                    </div>
                </div>
                <div class="col-md-9">
                    <div class="user__card">
                        <h1>Личный кабинет</h1>
                        <div class="account-row-inner">
                            <?
                            $rsUser = CUser::GetByID($USER->GetID());
                            $arUser = $rsUser->Fetch();
                            ?><div class="user__greeting">
                            <?
                            if (!empty($arUser['NAME']))
                            {
                                ?>

                                    <p class="cab_pad">Рады приветствовать Вас, <?= $arUser['NAME']; ?> <?= $arUser['SECOND_NAME'] ?>!</p>
                            <? } ?>
                            <?
                            if (!empty($arUser[LOGIN]))
                            {
                                ?>
                                <p class="cab_pad">Вы зарегистрированны в системе под логином <span
                                        class="text-important"><?= $arUser['LOGIN'] ?>
                                    </span>
                                </p>

                            <? } ?></div>
                            <div class="user__full__name"><?= $arUser['LAST_NAME'] ?> <?= $arUser['NAME'] ?> <?= $arUser['SECOND_NAME'] ?></div>

                            <?/*$arGroups = $USER->GetUserGroupArray();
                            foreach($arGroups as $gr){
                                $rsGroup = CGroup::GetByID($gr, "Y");
                                $arGroup = $rsGroup->Fetch();
                                echo "<p class='user_group'>"; echo $arGroup[NAME]; echo "</p>";
                            }*/?>

                            <div class="user__contacts">
                            <?
                            if (!empty($arUser['EMAIL']))
                            {
                                ?>
                                <a href="">
                                    <i class="icon-mail"></i><?= $arUser['EMAIL'] ?></a>
                            <? } ?>
                            <?
                            if (!empty($arUser['PERSONAL_MOBILE']))
                            {
                                ?>
                                <a href="">
                                    <i class="icon-phone"></i><?= $arUser['PERSONAL_MOBILE'] ?></a>
                            <? } ?>
                            </div>
                            <div class="user__change"  data-toggle="modal" data-target=".bs-example-modal-md"><a href="javascript:void(0)">Изменить данные</a></div>
                        </div>
                    </div>


                    <script>
                        var ajaxDir = "/personal/profile/";
                        $(window).bind('load', function () {
                            clg(ajaxDir + "ajax.php?");
                            var sendPersonalInfo = function (event) {
                                var $form = $("#personalForm");
                                var $win = $("#elementError");
                                $.getJSON("/personal/profile/ajax.php?" + $form.serialize(), function (data) {
                                    $win.show().text(data["message"]);
                                    $win.addClass(data["class"]);
                                    data["reload"] ? document.location.reload() : void 0;
                                });
                                event.preventDefault();

                            };

                            var windowClose = function (event) {
                                var $win = $("#elementError");
                                $win.data("reload") ? document.location.reload() : $("#elementError").hide();
                                event.preventDefault();
                            };

                            $(document).on("click", ".submit", sendPersonalInfo);
                            $(document).on("click", "#elementErrorClose, #elementError .close", windowClose);
                        });
                    </script>