<?php
/**
 * Created by PhpStorm.
 * User: IRIGC
 * Date: 31/05/2017
 * Time: 11:09 AM
 */

require_once 'ResourcesHolder/core/DAL/jdf/jdf.php';
require_once 'ResourcesHolder/core/DAL/DAL.php';
require_once 'ResourcesHolder/core/DAL/public-function.php';

$DAL = new DAL("constant.php");

$select = $DAL->Select('SELECT * FROM `app_request_list` WHERE `ID`=' . $_GET['id']);
$select = $select[0];
$date = date_create($select['arlTime']);
$date = convert(gregorian_to_jalali($date->format("Y"), $date->format("m"), $date->format("d"), '/'), false);

$html = '';
$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: blanchedalmond; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نام</td>';
$html .= '<td class="fBKoodakBold" colspan="3" style="background: blanchedalmond; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlFName'] . '</td>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background:#00acc1; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نام خانوادگی</td>';
$html .= '<td class="fBKoodakBold" colspan="5" style="background:#00acc1; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlLName'] . '</td>';
$html .= '</tr>';

$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background:#00FFFF; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">شماره تلفن</td>';
$html .= '<td class="fBKoodakBold" colspan="4" style="background:#00FFFF; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlPhoneNumber'] . '</td>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background:#ffd8a6; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">شماره تلفن ثابت</td>';
$html .= '<td class="fBKoodakBold" colspan="4" style="background:#ffd8a6; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlFixNumber'] . '</td>';
$html .= '</tr>';

$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: #b1dcfb; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">صنف</td>';
$html .= '<td class="fBKoodakBold" colspan="2" style="background: #b1dcfb; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlGuildName'] . '</td>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: #bbdaff;border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نام فروشگاه</td>';
$html .= '<td class="fBKoodakBold" colspan="2" style="background: #bbdaff;border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlShopName'] . '</td>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: #a5a5a5;border:groove 1px black; padding-bottom: 10px; padding-top: 10px">تاریخ</td>';
$html .= '<td class="fBKoodakBold" colspan="3" style="background: #a5a5a5;border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $date . '</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: #0f74a8; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">آدرس</td>';
$html .= '<td class="fBKoodakBold" colspan="9" style="background: #0f74a8; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlAddress'] . '</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="1" style="background: #2d8f6f; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">توضیحات</td>';
$html .= '<td class="fBKoodakBold" colspan="9" style="background: #2d8f6f; border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlMoreDetailes'] . '</td>';
$html .= '</tr>';


/*if ($select['arlMod'] == 'acceptor') {
    $html .= '<tr>';
    $html .= '<td class="fBKoodakBold" colspan="1" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نوع درخواست</td>';
    $html .= '<td class="fBKoodakBold" colspan="2" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">پذیرندگی</td>';
    $html .= '<td class="fBKoodakBold" colspan="2" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نام محل</td>';
    $html .= '<td class="fBKoodakBold" colspan="2" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlShopName'] . '</td>';
    $html .= '<td class="fBKoodakBold" colspan="1" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">صنف</td>';
    $html .= '<td class="fBKoodakBold" colspan="2" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">' . $select['arlGuildName'] . '</td>';
    $html .= '</tr>';
}
if ($select['arlMod'] == 'client') {
    $html .= '<tr>';
    $html .= '<td class="fBKoodakBold" colspan="5" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">نوع درخواست</td>';
    $html .= '<td class="fBKoodakBold" colspan="5" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">کارت</td>';
    $html .= '</tr>';
}*/
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td class="fBKoodakBold" colspan="2" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">وضعیت</td>';
if ($select['arlRead'] == '0') {
    $html .= '<td class="fBKoodakBold" colspan="4" style="border:groove 1px black; padding-bottom: 0px!important; padding-top: 0px!important;"><button style="width: 100%;height: 100%;" data-uid="' . $_GET['uid'] . '" id="add" data-id="' . $_GET['id'] . '">ثبت شد</button></td>';
} else {
    $html .= '<td class="fBKoodakBold" colspan="4" style="border:groove 1px black; padding-bottom: 0px!important; padding-top: 0px!important;">این مورد برسی شده</td>';
}
$html .= '<td class="fBKoodakBold" colspan="4" style="border:groove 1px black; padding-bottom: 0px!important; padding-top: 0px!important;"><button style="width: 100%;height: 100%;" data-uid="' . $_GET['uid'] . '" id="del" data-id="' . $_GET['id'] . '">حذف</button></td>';
$html .= '</tr>';

?>

<html>
<head>
    <link href="ResourcesHolder/resource/css/farsi-font/css/fonts.css" type="text/css"/>
    <script src="ResourcesHolder/resource/plugins/jquery/jquery.min.js" type="text/javascript"></script>
    <script src="ResourcesHolder/resource/js/main-script.js"></script>
    <style>
       /* html, body, div, span, applet, object, iframe,
        h1, h2, h3, h4, h5, h6, p, blockquote, pre,
        a, abbr, acronym, address, big, cite, code,
        del, dfn, em, img, ins, kbd, q, s, samp,
        small, strike, strong, sub, sup, tt, var,
        b, u, i, center,
        dl, dt, dd, ol, ul, li,
        fieldset, form, label, legend,
        table, caption, tbody, tfoot, thead, tr, th, td,
        article, aside, canvas, details, embed,
        figure, figcaption, footer, header, hgroup,
        menu, nav, output, ruby, section, summary,
        time, mark, audio, video {
            margin: 0;
            padding: 0;
            border: 0;
            font-size: 100%;
            vertical-align: baseline;
        }

        !* HTML5 display-role reset for older browsers *!
        article, aside, details, figcaption, figure,
        footer, header, hgroup, menu, nav, section {
            display: block;
        }

        body {
            line-height: 1;
            overflow-x: hidden;
        }

        ol, ul {
            list-style: none;
        }

        blockquote, q {
            quotes: none;
        }

        blockquote:before, blockquote:after,
        q:before, q:after {
            content: '';
            content: none;
        }

        table {
            border-collapse: collapse;
            border-spacing: 0;
        }*/
    </style>
</head>
<body>
<table style="width: 100%; text-align: center;" dir="rtl">
    <thead>
    <tr>

    </tr>
    <tr>
        <td class="fBKoodakBold" colspan="10" style="border:groove 1px black; padding-bottom: 10px; padding-top: 10px">مشخضات در خواست کننده
        </td>
    </tr>
    </thead>
    <tbody class="fBTitrBold">
    <?php echo $html; ?>
    </tbody>
    <tfoot>
    <tr>
        <td class="fBKoodakBold" colspan="10" style="text-align: center;padding-top:40px!important; " dir="ltr">
            &copy;
            <script>document.write(new Date().getFullYear())</script>
            <a href="http://digihelp.net">DigiHelp.net</a>
        </td>
    </tr>
    </tfoot>
</table>
<script>
    (function ($) {
        $(document).ready(function () {
            $('#add').bind().bind('touchstart click', function () {
                let button = $(this);
                LoadData({
                    request: 'proxy',
                    object: {
                        user: button.attr('data-uid'),
                        ID: button.attr('data-id')
                    },
                    action: 'requestController',
                    "header-type": 'deactive'
                }, null, false, function (data) {
                    if (data === '1') {
                        alert('انجام شد');
                        window.close();
                    } else {
                        alert('خطا')
                    }
                });
            });
            $('#del').bind().bind('touchstart click', function () {
                let button = $(this);
                LoadData({
                    request: 'proxy',
                    object: {
                        user: button.attr('data-uid'),
                        ID: button.attr('data-id')
                    },
                    action: 'requestController',
                    "header-type": 'delete'
                }, null, false, function (data) {
                    if (data === '1') {
                        alert('انجام شد');
                        window.close();
                    } else {
                        alert('خطا')
                    }
                });
            });
        });
    }(jQuery));
</script>
</body>
</html>