<?php
$path="../../";
include("../../map.php");
include("../../scripts.php");
if(isset($_GET["gun"]) && $_GET["gun"] < 10){ $ggun = "0" . $_GET["gun"]; } else { $ggun = isset($_GET["gun"]) ? $_GET["gun"] : date('d'); }
if(isset($_GET["ay"]) && $_GET["ay"] < 10){ $gay = "0" . $_GET["ay"]; } else { $gay = isset($_GET["ay"]) ? $_GET["ay"] : date('m'); }
$gyil = isset($_GET["yil"]) ? $_GET["yil"] : date('Y');
if($_GET["islem"]=="events"){$islem=translate("Etkinlik");}else{$islem=$sdil[68];}
?>
<style>
    legend { margin-bottom: 5px; border-bottom: 0px solid #e5e5e5; font-weight: bold; font-size: 14px; }
    .sam { display:none !important; }
    .cke_contents{ height:165px; }
    #cke_1_top {display:none !important;}
    ul {list-style: none;margin-top: 45px;}
    .sent {position: relative; float:right; margin-top:-10px; padding: 10px; border-radius: 5px;}
    .replies {position: relative; float:left; margin-top:10px; padding: 10px; border-radius: 5px;}
</style>
<div class="panel panel-default" style="display: flow-root;">
    <?php if ($_GET["durum"]=="nekle"){?>
        <div class="panel-heading">
			<?php if($_GET["islem"]=="notlar"){echo ctranslate("Etkinlik Ekle");}else{echo ctranslate("Not Ekle");}?>
			<span style="float:right;">
				<a class="btn btn-info" onclick="toggle('#cimage');" style="float:right;margin-top:-3px; margin-right:2px;"><i class="fa fa-image"></i></a>
			</span>
		</div>
        <div class="panel-body">
            <form method="POST" action="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&durum=enot" class="block-content form" id="complex_form" enctype="multipart/form-data">
                <div class="" style="clear:both;margin-bottom:20px;">
                    <input type="text" id="t1" name="t1" id="simple-required" value="" title="Başlık" class="v3-form-control <?php if($_GET["islem"]=="keep"){echo "dn";}?>" placeholder="<?php echo translate("Etkinlik Adı")?>"> 
                    <textarea name="n1" id="<?php if($_GET["islem"]=="notlar"){echo "rte";}?>" rows="5" cols="43" title="Not Detay" class="v3-form-control" style="margin-bottom:5px; margin-top:10px;" placeholder="<?php if($_GET["islem"]=="notlar"){echo ctranslate("Açıklama");}else{echo ctranslate("Not");}?>"></textarea><br>
                </div>
                <div class="row" style="clear:both; margin-bottom:15px;">
                    <div class="col-md-3 col-sm-3 col-xs-6" style="">
                        <input type="date" value="<?php echo $gyil . '-' . $gay . '-' . $ggun; ?>" name="t4" class="v3-form-control" style="border: 1px solid #fff;">
                    </div>
                    <div class="col-md-3 col-sm-3 col-xs-6 <?php if($_GET["islem"]=="keep"){echo "dn";}?>" id="fdate" style="">
                        <input type="date" value="<?php echo $gyil . '-' . $gay . '-' . $ggun; ?>" name="t9" class="v3-form-control" style="border: 1px solid #fff;">
                    </div>
                    <div class="col-md-2 col-sm-2 col-xs-6" style="">
                        <input type="time" name="t2" id="t2" value="00:00" title="Saat" class="v3-form-control" style="">
                    </div>
                    <div class="col-md-3 col-sm-3 col-xs-6" style="">
                        <select name="s3" class="v3-form-control" style="height: 34px;">
                            <option value="0"><?php echo $sdil[69]; //Tekrar Seçiniz?></option>
                            <option value="1"><?php echo $sdil[70]; //Aylık?></option>
                            <option value="2"><?php echo $sdil[71]; //Yıllık?></option>
                        </select>
                    </div>
                    <div class="col-md-12 col-sm-12" id="cimage" style="display:none;">
                        <input type="file" name="afile">
                    </div>
                </div>
                <?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='notlar' and n4<>'switch' and (n2='0') and s1=0 order by s10 asc");?>
                <?php if(mysqli_num_rows($sqli)>0){?>
                    <div class="panel-body" style="padding:0px;">
                        <div class="row">
                            <?php  while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
                                <div class="<?php if($rsi["n15"]==""){echo "col-xs-12 col-md-12";}else{echo $rsi["n15"];}?>" style="">
                                    <label><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></label>
                                    <?php if($rsi["n4"]=="input"){?>
                                        <input class="v3-form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="i<?php echo $i;?>" value="<?php echo $jsi["i".$i.""];?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                                    <?php }elseif($rsi["n4"]=="textarea"){?>
                                        <textarea class="v3-form-control <?php echo $rsi["n13"]?>" name="i<?php echo $i;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $jsi["i".$i.""];?></textarea>
                                    <?php }elseif($rsi["n4"]=="select"){?>
                                        <select class="v3-form-control <?php echo $rsi["n13"]?> chosen-select" name="i<?php echo $i;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                                            <option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
                                            <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                                <option value="<?php echo $rso["n2"]?>" <?php $q="";foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "selected";}}?>><?php echo $rso["n1"]?></option>
                                            <?php }?>
                                        </select>
                                    <?php }elseif($rsi["n4"]=="radio"){?>
                                        <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                            <div style="float:left; margin-right: 5px;">
                                                <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                                                <input type="radio" name="i<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($jsi["i".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>></label>
                                            </div>
                                        <?php }?>
                                    <?php }elseif($rsi["n4"]=="checkbox"){?>
                                        <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                            <div style="float:left; margin-right: 5px;">
                                                <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                                                <input type="checkbox" name="i<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "checked";}?><?php }?>></label>
                                            </div>
                                        <?php }?>
                                    <?php }?>
                                    <p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
                                </div>
                            <?php }?>
                        </div>
                        <div class="row">
                            <?php $w=0;$sqlw=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and n3='notlar' and n4='switch' and (n2='0') and s1=0 order by s10 asc"); while($rsw=mysqli_fetch_assoc($sqlw)){$w++;?>
                                <fieldset class="<?php if($rsw["n15"]==""){echo "col-xs-3 col-md-3";}else{echo $rsw["n15"];}?>" style="">
                                    <legend><?php echo $rsw["n1"];?><span style="font-size:8px; color:#ccc;">(m<?php echo $w;?>)</span></legend>
                                    <div class="switch switch-sm switch-success">
                                        <input type="checkbox" name="m<?php echo $w;?>" data-plugin-ios-switch="" value="1" class="switch" <?php if($jsm["m".$w.""]=="1"){?>Checked<?php }?>>
                                    </div>
                                </fieldset>
                            <?php }?>
                        </div>
                    </div>
                <?php }?>
                <div class="row"  style="clear:both; margin-bottom:20px; ">
                    <div class="col-sm-11">
                        <label><?php echo $t25s[0];?></label>
                        <?php $t5Sx = explode(',',$rs["t5"]);?>
                        <select name="t5[]" data-placeholder="Seçiniz" style="" class="v3-form-control chosen-select" tabindex="8" multiple>
                            <option value="0" title="Admin" alt="Admin" style="color:#6699FF" <?php foreach($t5Sx as $t5s){if($t5s==0){echo "selected";}}?>>Admin</option>
                            <?php $sql=mysqli_query($conn, "select * from t5 where s9=1"); while($rsm=mysqli_fetch_assoc($sql)){?>
                                <option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php foreach($t5Sx as $t5s){if($t5s==$rsm["id"]){echo "selected";}}?>><?php echo $rsm["t1"];?></option>
                            <?php }?>
                        </select>
                    </div>
                    <div class="col-sm-1"><i class="fa fa-plus" style="margin-top: 23px; font-size: 23px; color: green; cursor: pointer;" onclick="toggle('#uform');"></i></div>
                    <div id="uform" style="display:none;">
                        <div class="col-sm-4" style="margin-top:20px;">
                            <input type="text" class="v3-form-control" name="ut1" placeholder="Ad Soyad">
                        </div>
                        <div class="col-sm-4" style="margin-top:15px;">
                            <input type="text" class="v3-form-control" name="ut2" placeholder="Email">
                        </div>
                        <div class="col-sm-4" style="margin-top:15px;">
                            <input type="text" class="v3-form-control phone" name="ut4" placeholder="Telefon">
                        </div>
                    </div>
                </div>
                <button type="submit" class="btn btn-primary" style="float:right;"><?php echo ctranslate("Oluştur")?></button>
            </form>
        </div>
        <?php
    }elseif ($_GET["durum"]=="noku"){
        $sqe=mysqli_query($conn, "select * from genel where id=".$_GET["id"].""); $event=mysqli_fetch_assoc($sqe); $jsi = json_decode($event["n16"], true); $jsm = json_decode($event["n17"], true); $t5s = explode(',',$event["t5"]);
        $squ=mysqli_query($conn, "select * from t5 where id='".$event["s1"]."'"); $uye=mysqli_fetch_assoc($squ);
        if ($event["t3"]=="gorev" or $authority==0){
            $yetki=0;
        }else{
            $yetki=1;
        }
        if(in_array($_SESSION["user_id"], $t5s)){}
            ?>
        <div class="panel-heading"><?php echo translate("Etkinliği Düzenle")?>
        <span style="float:right;">
            <?php if($_SESSION["kim"]=="Admin" or ($_SESSION["kim"]=="yonetici" and $_SESSION["user_id"]==$rs["s19"])){?><a class="btn btn-danger" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $event["id"];?>&ay=<?php echo $_REQUEST["ay"];?>&yil=<?php echo $_REQUEST["yil"];?>&durum=snot" style="float:right;margin-top:-3px; margin-right:2px;"><i class="fa fa-trash"></i></a><?php }?>
            <a class="btn btn-info" onclick="toggle('#cimage');" style="float:right;margin-top:-3px; margin-right:2px;"><i class="fa fa-image"></i></a>
            <a class="btn btn-info" onclick="toggle('#qrcode');" style="float:right;margin-top:-3px; margin-right:2px;"><i class="fa fa-qrcode"></i></a>
            <a class="btn btn-warning" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $event["id"];?>&ay=<?php echo $_REQUEST["ay"];?>&yil=<?php echo $_REQUEST["yil"];?>&durum=enot" style="float:right;margin-top:-3px; margin-right:2px; padding: 3px 7px;"><i class="fa fa-plus"></i></a>
            <?php if($event["s4"]=="1"){?><a class="btn btn-warning" style="float:right;margin-top:-3px;  margin-right:2px;"><i class="fa fa-share-square-o" aria-hidden="true" title="Mail Gönderildi"></i></a><?php }?>
            <?php if($event["s3"]<>0){?><a class="btn btn-warning" style="float:right;margin-top:-3px;  margin-right:2px;"><i class="fa fa-refresh" aria-hidden="true"  title="Tekrarlanıyor."></i></a><?php }?>
        </span>
    </div>
    <div class="panel-body">
        <form method="POST" action="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&durum=dnot&id=<?php echo $_GET["id"]?>" class="block-content form" id="complex_form" enctype="multipart/form-data">       
            <div class="" style="clear:both; margin-bottom:15px;">
                <input type="text" id="t1" name="t1" id="simple-required" title="Başlık" class="v3-form-control <?php if($_GET["islem"]=="keep"){echo "dn";}?>" placeholder="<?php echo $sdil[68]; //Not?> <?php echo $sdil[39]; //Başlık?>" value="<?php echo $event["t1"];?>"> 
                <textarea name="n1" id="<?php if($_GET["islem"]<>"keep"){echo "rte";}?>" rows="5" cols="43" title="Not Detay" class="v3-form-control" style="margin-bottom:5px; margin-top:10px;" placeholder="<?php echo $sdil[68]; //Not?> <?php echo $sdil[207]; //Detay?>"><?php echo $event["n1"];?></textarea><br>
            </div>
            <div class="row" style="clear:both; margin-bottom:15px;">
                <div class="col-md-3 col-sm-3" style="">
                    <input type="date" value="<?php echo isset($event["t4"]) && !empty($event["t4"]) ? $event["t4"] : $gyil . '-' . $gay . '-' . $ggun; ?>" name="t4" class="v3-form-control" style="border: 1px solid #fff;">
                </div>
                <div class="col-md-3 col-sm-3" id="fdate">
                    <input type="date" value="<?php echo isset($event["t9"]) && !empty($event["t9"]) ? $event["t9"] : $gyil . '-' . $gay . '-' . $ggun; ?>" name="t9" class="v3-form-control" style="border: 1px solid #fff;">
                </div>
                <div class="col-md-3 col-sm-3" style="">
                    <input type="time" name="t2" id="t2" title="Saat" class="v3-form-control" style="" value="<?php echo $event["t2"];?>">
                </div>
                <div class="col-md-3 col-sm-3" style="">
                    <select name="s3" class="v3-form-control" style="">
                        <option value="0" <?php if($event["s3"]==0){?>selected<?php }?>><?php echo $sdil[69]; //Tekrar Seçiniz?></option>
                        <option value="1" <?php if($event["s3"]==1){?>selected<?php }?>><?php echo $sdil[70]; //Aylık?></option>
                        <option value="2" <?php if($event["s3"]==2){?>selected<?php }?>><?php echo $sdil[71]; //Yıllık?></option>
                    </select>
                </div>
            </div>
            <div class="row" style="clear:both; margin-bottom:15px; display:none;" id="cimage">
                <?php if($event["t6"]<>""){?>
                    <div class="col-md-12 col-sm-12 cp">
                        <img src="<?php echo $weburl."/deppo/image/".$event["t6"];?>" style="height:250px;">
                        <a href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&durum=simage&id=<?php echo $_GET["id"]?>" style="position: absolute; left: 20px ; top: 10px ; background: white; border-radius: 5px ; font-size: 11px; padding: 3px ;"><?php echo translate("+#Kaldır")?></a>
                    </div>
                <?php }else{?>
                    <div class="col-md-12 col-sm-12">
                        <input type="file" name="afile">
                    </div>
                <?php }?>
            </div>
            <img id="qrcode" src="<?php echo qrCode("".$weburl."/?n".$_GET["id"]."/qr",140);?>" style="display:none;">
        </div>
        <div class="row" style="">
            <?php if($event["n12"]<>""){?>
                <div class="v3-col-sm-6 v3-col-xs-12" style="margin-bottom:15px;">
                    <table class="v3-table">
                        <?php
                        $arrays = json_decode($event["n12"], true);
                        foreach($arrays as $key=>$value){
                            ?>
                            <tr>
                                <td style="width:60%"><?php echo $key;?></td>
                                <td> : <?php echo is_array($value) ? $value[0] : $value;?> <?php echo $ikpb?></td>
                            </tr>
                        <?php }?>
                    </table>
                </div>
            <?php }?>
            <?php if($event["n11"]<>""){?>
                <div class="v3-col-sm-6 v3-col-xs-12" style="margin-bottom:15px;">
                    <table class="v3-table">
                        <?php
                        $arrays2 = json_decode($event["n11"], true);
                        foreach($arrays2 as $key2=>$value2){
                            ?>
                            <tr>
                                <td style="width:60%"><?php echo ltrim($key2,'i');?></td>
                                <td> : <?php echo is_array($value2) ? $value2[0] : $value2;?></td>
                            </tr>
                        <?php }?>
                    </table>
                </div>
            <?php }?>
        </div>
        <?php $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='notlar' and n4<>'switch' and (n2='0' or n2='".$event["id"]."') and s1=0 order by s10 asc");?>
        <?php if(mysqli_num_rows($sqli)>0){?>
            <div class="panel-body" style="">
                <div class="row">
                    <?php  while($rsi=mysqli_fetch_assoc($sqli)){$i++;?>
                        <div class="<?php if($rsi["n15"]==""){echo "col-xs-12 col-md-12";}else{echo $rsi["n15"];}?>" style="">
                            <label><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (i<?php echo $i;?>)</span></label>
                            <?php if($rsi["n4"]=="input"){?>
                                <input class="v3-form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="i<?php echo $i;?>" value="<?php echo $jsi["i".$i.""];?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                            <?php }elseif($rsi["n4"]=="textarea"){?>
                                <textarea class="v3-form-control <?php echo $rsi["n13"]?>" name="i<?php echo $i;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $jsi["i".$i.""];?></textarea>
                            <?php }elseif($rsi["n4"]=="select"){?>
                                <select class="v3-form-control <?php echo $rsi["n13"]?> chosen-select" name="i<?php echo $i;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
                                    <option value=""><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
                                    <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                        <option value="<?php echo $rso["n2"]?>" <?php $q="";foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "selected";}}?>><?php echo $rso["n1"]?></option>
                                    <?php }?>
                                </select>
                            <?php }elseif($rsi["n4"]=="radio"){?>
                                <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                    <div style="float:left; margin-right: 5px;">
                                        <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                                        <input type="radio" name="i<?php echo $i;?>" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php if($jsi["i".$i.""]==$rso["n2"] or $rso["n3"]==1){echo "checked";}?>></label>
                                    </div>
                                <?php }?>
                            <?php }elseif($rsi["n4"]=="checkbox"){?>
                                <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                    <div style="float:left; margin-right: 5px;">
                                        <label style="float:left; margin-right:5px;"><?php echo $rso["n1"];?>
                                        <input type="checkbox" name="i<?php echo $i;?>[]" value="<?php echo $rso["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($jsi["i".$i.""] as $q){?><?php if($q==$rso["n2"] or $rso["n3"]==1){echo "checked";}?><?php }?>></label>
                                    </div>
                                <?php }?>
                            <?php }?>
                            <p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
                        </div>
                    <?php }?>
                </div>
                <div class="col-md-12 row">
                    <?php $w=0;$sqlw=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and n3='notlar' and n4='switch' and (n2='0' or n2='".$event["id"]."') and s1=0 order by s10 asc"); while($rsw=mysqli_fetch_assoc($sqlw)){$w++;?>
                        <fieldset class="<?php if($rsw["n15"]==""){echo "col-xs-3 col-md-3";}else{echo $rsw["n15"];}?>" style="">
                            <legend><?php echo $rsw["n1"];?><span style="font-size:8px; color:#ccc;">(m<?php echo $w;?>)</span></legend>
                            <div class="switch switch-sm switch-success">
                                <input type="checkbox" name="m<?php echo $w;?>" data-plugin-ios-switch="" value="1" class="switch" <?php if($jsm["m".$w.""]=="1"){?>Checked<?php }?>>
                            </div>
                        </fieldset>
                    <?php }?>
                </div>
            </div>
        <?php }?>
        <div class="col-md-12 col-sm-12" style="clear:both; margin-bottom:15px; ">
            <label><?php echo $t25s[0];?></label>
            <?php $t5Sx = explode(',',$event["t5"]);?>
            <select name="t5[]" data-placeholder="Seçiniz" style="" class="v3-form-control chosen-select" tabindex="8" multiple>
                <option value="0" title="Admin" alt="Admin" style="color:#6699FF" <?php foreach($t5Sx as $t5s){if($t5s==0){echo "selected";}}?>>Admin</option>
                <?php $sql=mysqli_query($conn, "select * from t5 where s9=1"); while($rsm=mysqli_fetch_assoc($sql)){?>
                    <option value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php foreach($t5Sx as $t5s){if($t5s==$rsm["id"]){echo "selected";}}?>><?php echo $rsm["t1"];?></option>
                <?php }?>
            </select>
        </div>
        <div class="col-md-12 row" style="clear:both; margin-bottom:15px; ">
            <table class="table noshadow">
                <?php
                if($event["t3"]=="gorev"){
                    $sql=mysqli_query($conn, "select * from genel where ne='gorev' and id=".$event["s1"].""); $rs=mysqli_fetch_assoc($sql);
                    $jsi = json_decode($rs["n17"], true);
                    $jsm = json_decode($rs["n18"], true);
                    $sql2=mysqli_query($conn, "select * from t5 where id=".$rs["t11"].""); $rs5=mysqli_fetch_assoc($sql2);
                    $ut1=$rs5["t1"]; $ut2=$rs5["t2"]; $ut4=$rs5["t4"];
                    $i=0;$sqli=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and n3='".$event["t3"]."' and n4<>'switch' and (n2='0' or n2='".$event["s1"]."') and s1=0 order by s10 asc"); while($rsi=mysqli_fetch_assoc($sqli)){$i++
                        ?>
                        <tr>
                            <td style="width:20%">
                                <b><?php echo $rsi["n1"];?></b>
                            </td>
                            <td> : 
                                <?php if(is_array($jsi["i".$i.""])){?>
                                    <?php $o=0;$sqlo=mysqli_query($conn, "select * from genel where ne='inputs' and s1=".$rsi["id"]." order by s10 asc"); while($rso=mysqli_fetch_assoc($sqlo)){$o++;?>
                                        <?php $q="";foreach($jsi["i".$i.""] as $q){ if($q==$rso["n2"]){echo $q;}}?>
                                        <?php }?><br>
                                    <?php }else{?>
                                        <?php echo $jsi["i".$i.""];?><br>
                                    <?php }?>
                                </td>
                            </tr>
                        <?php }?>
                        <table>
                            <hr style="margin:5px !important;">
                            <?php $w=0;$sqlw=mysqli_query($conn, "select * from genel where ne='inputs' and t2='".$_SESSION["lang"]."' and n3='".$event["t3"]."' and n4='switch' and (n2='0' or n2='".$event["s1"]."') and s1=0 order by s10 asc"); while($rsw=mysqli_fetch_assoc($sqlw)){$w++;?>
                                <b><?php echo $rsw["n1"];?></b> : 
                                <?php if($jsm["m".$w.""]=="1"){?><i class="fa fa-check"></i><?php }?>
                            <?php }?>
                        <?php }?>
						<div style="position: absolute; right: 98px;">
							<input type="checkbox" name="s7" value="1" class="<?php if($_GET["islem"]<>"keep"){echo "dn";}?>" <?php if($event["s7"]=="1"){echo "checked";}?>> Dashboard
						</div>
                        <button type="submit" class="btn btn-primary" style="float:right;" <?php if($_SESSION["kim"]=="Admin" or ($_SESSION["kim"]=="yonetici" and $_SESSION["user_id"]==$rs["s19"])){}else{echo "disabled";}?>><?php echo $sdil[203]; //Güncelle?></button>
                    </form>
                </div>
                
                <?php
            }elseif($event["t3"]=="hizmet"){
                $sqh=mysqli_query($conn, "select * from t4 where id='".$event["s2"]."'"); $hiz=mysqli_fetch_assoc($sqh);
                ?>
                <div class="panel-heading"><?php echo $uye["t1"];?> > <?php echo translate(ihb($event["t3"]))?>
                <span style="float:right;">
                    <?php if(($_SESSION["kim"]=="Admin") or ($_SESSION["kim"]=="yonetici" and $_SESSION["y11"]==1)){?>
                        <a class="btn btn-danger" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $event["id"];?>&ay=<?php echo $_GET["ay"];?>&yil=<?php echo $_GET["yil"];?>&durum=snot" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-trash"></i></a>
                    <?php }?>
                    <a class="btn btn-info" href="<?php echo $weburl?>/<?php echo $crmpath?>/?ne=uye&islem=duye&id=<?php echo $uye["id"];?>&durum=hok#&tab-hizmet" target="_top" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-pencil"></i></a>
                </span>
            </div>
            <div class="panel-body">
                <?php echo $hiz["n1"];?>
                <br /><br />
                <?php echo translate("Başlama Tarihi")?> : <span id="link"><?php echo $hiz["t3"];?></span> / <?php echo translate("Bitiş Tarihi")?> : <span id="link"><?php echo $hiz["t4"];?></span>
            </div>
            <?php
        }elseif($event["t3"]=="senet"){
            $sqh=mysqli_query($conn, "select * from genel where ne='senet' and id='".$event["s2"]."'"); $hiz=mysqli_fetch_assoc($sqh);
            ?>
            <div class="panel-heading"><?php echo $uye["t1"];?> > <?php echo translate(ihb($event["t3"]))?>
            <span style="float:right;">
                <?php //if(($_SESSION["kim"]=="Admin") or ($_SESSION["kim"]=="yonetici" and $_SESSION["y11"]==1)){?>
                    <a class="btn btn-danger" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $event["id"];?>&ay=<?php echo $_GET["ay"];?>&yil=<?php echo $_GET["yil"];?>&durum=snot" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-trash"></i></a>
                    <?php //}?>
                    <a class="btn btn-info" href="<?php echo $weburl?>/<?php echo $crmpath?>?ne=muhasebe&islem=senet" target="_top" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-pencil"></i></a>
                </span>
            </div>
            <div class="panel-body">
                <?php echo $hiz["n1"];?>
                <br /><br />
                <?php echo translate("Kesilme Tarihi")?> : <span id="link"><?php echo $hiz["t9"];?></span> / <?php echo translate("Vade Tarihi")?> : <span id="link"><?php echo $hiz["t10"];?></span>
            </div>
            <?php
        }elseif($event["t3"]=="cek"){
            $sqh=mysqli_query($conn, "select * from genel where ne='cek' and id='".$event["s2"]."'"); $hiz=mysqli_fetch_assoc($sqh);
            ?>
            <div class="panel-heading"><?php echo $uye["t1"];?> > <?php echo translate(ihb($event["t3"]))?>
            <span style="float:right;">
                <?php //if(($_SESSION["kim"]=="Admin") or ($_SESSION["kim"]=="yonetici" and $_SESSION["y11"]==1)){?>
                    <a class="btn btn-danger" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&id=<?php echo $event["id"];?>&ay=<?php echo $_GET["ay"];?>&yil=<?php echo $_GET["yil"];?>&durum=snot" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-trash"></i></a>
                    <?php //}?>
                    <a class="btn btn-info" href="<?php echo $weburl?>/<?php echo $crmpath?>?ne=muhasebe&islem=cek" target="_top" style="float:right; margin-top:-3px; margin-right:2px;"><i class="fa fa-pencil"></i></a>
                </span>
            </div>
            <div class="panel-body">
                <?php echo $hiz["n1"];?>
                <br /><br />
                <?php echo translate("Kesilme Tarihi")?> : <span id="link"><?php echo $hiz["t9"];?></span> / <?php echo translate("Vade Tarihi")?> : <span id="link"><?php echo $hiz["t10"];?></span>
            </div>
        <?php }?>
        <div class="mt5 mmt5" style="<?php if($_GET["durum"]<>"noku"){echo "display:none;";}?>">
            <div style="width: 100%; clear: both; padding: 10px 0px;">
                <a class="v3-btn v3-btn-success fr mfr" style="padding: 5px 7px;" onclick="jQuery('#s1').val('0'); jQuery('#s2').val('1'); jQuery('#ctext').attr('placeholder', 'Müşteri;'); toggle('#cdform')"><i class="far fa-comment-dots"></i> Müşteri</a>
                <a class="v3-btn v3-btn-warning fr mfr mr5 mmr5" style="padding: 5px 7px;" onclick="jQuery('#s1').val('1'); jQuery('#s2').val('0'); jQuery('#ctext').attr('placeholder', 'Admin;'); toggle('#cdform')"><i class="far fa-comment-dots"></i> Admin</a>
            </div>
            <div style="display:none;width: 100%; clear: both; margin-top: 35px;" id="cdform">
                <form action="?ne=<?php echo $_GET['ne'];?>&islem=<?php echo $_GET['islem'];?>&durum=chat&id=<?php echo $_GET["id"]?>" method="post" id="cform" style=" width:100%;">
                    <input type="hidden" id="s1" name="s1" value="">
                    <input type="hidden" id="s2" name="s2" value="">
                    <div class="v3-input-group">
                        <textarea class="v3-form-control" id="ctext" name="text" placeholder="<?php echo ctranslate("Not")?>" style="border: 1px solid grey !important;"></textarea>
                        <span class="v3-input-group-addon">
                            <input type="submit" name="btn" class="v3-btn v3-btn-warning fr mfr mr5 mmr5" style="padding: 5px 7px;" value="Gönder"></input>
                        </span>
                    </div>
                </form>
            </div>
            <ul>
                <?php $sqlc=mysqli_query($conn, "select id,t2,s1,s2,n1,ts1 from t2 where ne='chat' and t2='keep' and s3=".$_GET["id"]." order by id desc"); while($rsc=mysqli_fetch_assoc($sqlc)){ ?>
                    <li class="<?php if($rsc["s1"]==$_SESSION["user_id"]){echo "w20 mw45 sent v3-bg-success";}elseif($rsc["s2"]==$_SESSION["user_id"] or $rsc["t2"]=='all'){echo "w20 mw45 replies v3-bg-warning";}?>" style="clear:both; margin-bottom:15px;">
                        <?php if($rsc["s1"]==$_SESSION["user_id"]){?>
                            <i class="fas fa-caret-right" style="color: #d4edda; position: absolute; right: -7px; top: -11px; font-size: 30px; transform: rotate(90deg);"></i>
                        <?php }elseif($rsc["s2"]==$_SESSION["user_id"] or $rsc["t2"]=='all'){?>
                            <i class="fas fa-caret-left" style="color: #fff3cd; position: absolute; left: -7px; top: -11px; font-size: 30px; transform: rotate(-90deg);"></i>
                        <?php }?>
                        <?php if($rsc["s1"]==0){?>
                            <span class="prf"><b><?php echo ctranslate("Müşteri");?></b></span>
                        <?php }else{?>
                            <?php $sql=mysqli_query($conn, "select * from t5 where id=".$rsc["s1"]." or id=".$rsc["s2"].""); $rsu=mysqli_fetch_assoc($sql);?>
                            <span class="prf"><b><?php echo $rsu["t1"];?></b></span>
                        <?php }?>
                        <p><?php echo $rsc["n1"]?><span style="font-size:9px; display:block;"><?php echo timeAgo($rsc["ts1"])?></span></p>
                    </li>
                <?php }?>
            </ul>
        </div>
    </div>
<?php
if ($_GET["durum"]=="enot"){
	if($_POST["ut4"]<>""){
		$sqlk=mysqli_query($conn, "select * from t5 where t4='".$_POST["ut4"]."'"); $rsk=mysqli_fetch_assoc($sqlk);
		if(mysqli_num_rows($sqlk)==0 and $_POST["ut4"]<>""){
			$sqli5 = $conn->query("insert into t5(t1, t2, ne, s1, s4, s5, t3, t4, ts1, s19) values ('".$_POST["ut1"]."', '".base64_encode($_POST["ut2"])."', 'uye', '0', '1', '0', '".base64_encode(generatePassword(8))."', '".$_POST["ut4"]."', now(), '".$_SESSION["user_id"]."')"); 
			$sql5=mysqli_query($conn, "select * from t5 order by id desc"); $rs5=mysqli_fetch_assoc($sql5);
			$st5=$rs5["id"];
		}else{
			$st5=$rsk["id"];
		}
	}else{
		if(!empty($_POST["t5"])){$st5 = implode(',',$_POST["t5"]);}else{$st5="0";}
	}
	if(!empty($_POST["s3"])){$ss3=$_POST["s3"];}else{$ss3="0";}
	$iarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="i"){
			$iarr = $iarr + array( $key => $value);
		}
	}
	$marr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="m"){
			$marr = $marr + array( $key => $value);
		}
	}
	$rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$rjsm = json_encode($marr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	if($_FILES["afile"]["size"] > 0){   //form Mesaj için "afile"
	$kaydedilecekyer = "../../../deppo/image";
	$kaynak = $_FILES["afile"]["tmp_name"];
	$isim       = $_FILES["afile"]["name"];
	$uzanti     = explode('.',$_FILES['afile']['name']);
	$rand       = substr(md5(uniqid(rand())),0,10);
	$yeni       = "event-".$rand.".".$uzanti[count($uzanti)-1]."";
	move_uploaded_file ($_FILES["afile"]["tmp_name"], $kaydedilecekyer . "/".$yeni);
	}
	//if($_POST["t5"]){$st5 = $_POST["t5"];}else{$st5="0";}
	$sql = $conn->query("insert into genel(t1, t2, t3, t4, t5, t6, t9, ne, n1, n16, n17, s3, s19, ts1, ts2) values ('".addslashes($_POST["t1"])."', '".addslashes($_POST["t2"])."', '".$_GET["islem"]."', '".$_POST["t4"]."', '".$st5."', '".$yeni."', '".$_POST["t9"]."', 'not', '".addslashes($_POST["n1"])."', '".addslashes(stripslashes($rjsi))."', '".addslashes(stripslashes($rjsm))."', '".$ss3."', '".$_SESSION["user_id"]."', now() ,now())");
	$last_id = $conn->insert_id;
	foreach ($_POST["t5"] as $id){
		if ($id != "0"){
			$sqlc=mysqli_query($conn, "select * from t5 where id='".$id."'"); $rsc=mysqli_fetch_assoc($sqlc);
			$mesaj  = "
			<h3>".$_POST["t1"]."</h3>
			<p>".$_POST["n1"]."</p>
			";
			$malici = base64_decode($rsc["t2"]);
			$konu       = translate("+#E-Ajanda Notu Eklendi");
			$path       =   "../../../../";
			$mesaj  = $design_top.$mesaj.$design_bottom;
			emailgonder($malici,$konu,$cc,$mesaj);
		}
	}
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&ay=".$_REQUEST["ay"]."&yil=".$_REQUEST["yil"]."&durum=noku&id=".$last_id."",self,500,1);
}elseif ($_GET["durum"]=="dnot"){
    $iarr = array();
    foreach ($_POST as $key => $value){
        if(substr($key,0,1)=="i"){
            $iarr = $iarr + array( $key => $value);
        }
    }
    $marr = array();
    foreach ($_POST as $key => $value){
        if(substr($key,0,1)=="m"){
            $marr = $marr + array( $key => $value);
        }
    }
    $rjsi = json_encode($iarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
    $rjsm = json_encode($marr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
    if(!empty($_POST["t5"])){$st5 = implode(',',$_POST["t5"]);}else{$st5="0";}
	if(!empty($_POST["s7"])){$ss7=$_POST["s7"];}else{$ss7="0";}
	if($_FILES["afile"]["size"] > 0){   //form Mesaj için "afile"
	$kaydedilecekyer = "../../../deppo/image";
	$kaynak = $_FILES["afile"]["tmp_name"];
	$isim       = $_FILES["afile"]["name"];
	$uzanti     = explode('.',$_FILES['afile']['name']);
	$rand       = substr(md5(uniqid(rand())),0,10);
	$yeni       = "event-".$rand.".".$uzanti[count($uzanti)-1]."";
	move_uploaded_file ($_FILES["afile"]["tmp_name"], $kaydedilecekyer . "/".$yeni);
	}
	$Sql = mysqli_query($conn, "update genel set t1='".addslashes($_POST["t1"])."', t2='".addslashes($_POST["t2"])."', t3='".$_GET["islem"]."', t4='".$_POST["t4"]."', t5='".$st5."', t6='".$yeni."', t9='".$_POST["t9"]."', n1='".addslashes($_POST["n1"])."', n16='".addslashes(stripslashes($rjsi))."', n17='".addslashes(stripslashes($rjsm))."', s3='".$_POST["s3"]."', s7='".$ss7."' where id=".$_GET["id"]."");
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&ay=".$_REQUEST["ay"]."&yil=".$_REQUEST["yil"]."&durum=noku&id=".$_REQUEST["id"]."",self,500,1);
}elseif($_GET["durum"] == "simage"){
    $sqe=mysqli_query($conn, "select * from genel where id=".$_GET["id"].""); $event=mysqli_fetch_assoc($sqe);
    $dosya1="../../../deppo/image/".$event["t6"]."";unlink($dosya1);
    $Sql = mysqli_query($conn, "update genel set t6='' where id=".$_GET["id"]."");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&ay=".$_REQUEST["ay"]."&yil=".$_REQUEST["yil"]."&durum=noku&id=".$_REQUEST["id"]."",self,500,1);
}elseif($_GET["durum"] == "snot"){
    $Rs = mysqli_query($conn, "delete from genel where id=".$_GET["id"]."");
    $Rs = mysqli_query($conn, "delete from t2 where s3=".$_GET["id"]."");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&ay=".$_REQUEST["ay"]."&yil=".$_REQUEST["yil"]."&durum=nekle&id=".$_REQUEST["id"]."",self,500,1);
}elseif($_GET["durum"]=="chat"){
    $Sql = $conn->query("insert into t2(ne,t1,t2,s1,s2,s3,n1,ts1) values ('chat', '".getRealIpAddr()."', 'keep' , '".$_POST["s1"]."', '".$_POST["s2"]."', '".$_GET["id"]."', '".$_POST["text"]."', now())");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=noku&id=".$_GET["id"]."",self,500,1);
}
echo $footer;
?>
<script type="text/javascript">
    CKEDITOR.replace( 'rte', {
        toolbar: [ { name: 'document', items: [ 'Source'] }, [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ], { name: 'basicstyles', items: [ 'Bold', 'Italic' ] } ]
    });
</script>
<?php include("../public/log.php");?>