<?php /* Smarty version Smarty-3.1.11, created on 2025-08-06 00:48:10
         compiled from "../views/default/generateserial/serial.html" */ ?>
<?php /*%%SmartyHeaderCode:1293053044583d6b36a89189-13619514%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '5fdf2215ca5ee0ecc37af834f4859b6561e4ddfb' => 
    array (
      0 => '../views/default/generateserial/serial.html',
      1 => 1754441257,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1293053044583d6b36a89189-13619514',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_583d6b3700ec53_91476048',
  'variables' => 
  array (
    'flag' => 0,
    'serial' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_583d6b3700ec53_91476048')) {function content_583d6b3700ec53_91476048($_smarty_tpl) {?><style>
    .serialDiv{
        text-align: center;
        //color: white;
        font-weight: bold;
        border: 1px solid #019660;
        border-radius: 15px/10% !important;
        padding: 10px 12px 10px;
        background-color: #7FBDA7;
    }
</style>
<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">ترخيص جهاز</a></li>
            <li><a href="generateserial.php">ترخيص جهاز</a></li>
            <li class="active">اضافة ترخيص جهاز</li>
        </ol>


        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة ترخيص جهاز</h3>
            </div>
            <div class="panel-body">

                <form class="nameToBeChecked form-horizontal" action="generateserial.php" method="post" >

                    <div class="serialDiv">
                        <?php if ($_smarty_tpl->tpl_vars['flag']->value!="0"){?>
                        <p style="color: black"><u><?php echo $_smarty_tpl->tpl_vars['flag']->value;?>
</u></p>
                        <p style="color: white" id="myDiv"><?php echo $_smarty_tpl->tpl_vars['serial']->value;?>
</p>
                        <?php }else{ ?>
                        <p style="color: black">السيربال الخاص بهذا العميل هو:</p>
                        <p style="color: white" id="myDiv"><?php echo $_smarty_tpl->tpl_vars['serial']->value;?>
</p>
                        <?php }?>

                    </div>

                    <!-- =================================================   -->
                    <br/>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="submit"  class="btn btn-default pull-left">رجوع</button>
                        </div>
                        <div class="col-lg-4">
                            <button type="button" class="btn btn-success" onclick="copyDivToClipboard()">نسخ</button>
                        </div>

                    </div>


                </form>
            </div>
        </div>




    </div>
</div>


<script>
function copyDivToClipboard() {
    const text = document.getElementById("myDiv").innerText;

    if (navigator.clipboard && window.isSecureContext) {
        // Modern browser, HTTPS
        navigator.clipboard.writeText(text).then(() => {
            alert("تم النسخ ");
        }).catch(err => {
            console.error("Failed to copy: ", err);
        });
    } else {
        // Fallback for older browsers or non-HTTPS
        const textarea = document.createElement("textarea");
        textarea.value = text;
        // Prevent scrolling on mobile
        textarea.style.position = "fixed";
        textarea.style.top = "0";
        textarea.style.left = "0";
        textarea.style.opacity = "0";
        document.body.appendChild(textarea);
        textarea.focus();
        textarea.select();

        try {
            const successful = document.execCommand('copy');
            if (successful) {
                alert("Copied to clipboard!");
            } else {
                alert("Failed to copy.");
            }
        } catch (err) {
            console.error("Fallback: Oops, unable to copy", err);
        }

        document.body.removeChild(textarea);
    }
}
</script>




<?php }} ?>