<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../scripts.php");
	include("../../secure.php");
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $sdil[7]; //Sevkiyat & Desi İşlemleri?></title>
</head>
<body>
	<div class="alert alert-warning" id="result" style="display:none;"></div>
    <div class="" style="padding:0px 15px;">
        <div class="row">
            <!-- İçerik alanı -->
            <div class="col-12">
                <div class="tab-content" id="pills-tabContent">
                    <div class="tab-pane show active" id="pills-content-1" role="tabpanel" aria-labelledby="pills-tab-1">
							<table class="table table-no-more table-bordered table-striped mb-0" style="overflow:auto;">
                            <tr class="tittr mdn">
                                <td><?php echo translate("#Sevkiyat Firma(lar)")?></td>
                                <?php if($module["f3_location"]=="1"){?>
                                    <td class="w15"><?php echo translate("#Ülke")?></td>
                                    <td class="w15"><?php echo translate("#Şehir")?></td>
                                <?php }?>
                                <td class="w6"><?php echo translate("#Sıra")?></td>
                                <td class="w6"><?php echo translate("#İşlem")?></td>
                            </tr>
                            <form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=ekle">
                                <input type="hidden" value="kargo" name="ne">   
                                <tr class="addtr mdfx">
                                    <td class="mw70 tw80 mfl">
                                        <input type="text" name="t1" size="20" value="" title="<?php echo translate("#Seviyat Firma(lar)")?>" placeholder="<?php echo translate("#Sevkiyat Firma(lar)")?>" class="with-tip form-control">
                                    </td>
                                    <?php if($module["f3_location"]=="1"){?>
                                        <td class="mdn">
                                            <select id="ulkeadd" name="t2" class="v3-form-control v3-input-sm" style=""></select>
                                        </td>
                                        <td class="mdn">
                                            <select id="iladd" name="t3" class="v3-form-control v3-input-sm" style=""></select>
                                        </td>
                                        <script>
                                            jQuery(document).ready(function() {
                                                jQuery('#ulkeadd').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=ulke&sID=<?php echo $module["countrycode"];?>');
                                                jQuery('#iladd').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=bolge&ID=<?php echo $module["countrycode"];?>');
                                            });
                                            jQuery('#ulkeadd').on('change', function(){
                                                var ID = jQuery('#ulkeadd option:selected').attr('ID');
                                                jQuery('#iladd').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=bolge&ID='+ID);
                                            })
                                        </script>
                                    <?php }?>
                                    <td class="mdn">
                                        <input type="text" name="s10" size="1" value="0" title="sıra" class="with-tip form-control">
                                    </td>
                                    <td class="mw30 tw15 mfl">
                                        <div class="input-group-btn">
                                            <button tabindex="-1" class="btn btn-warning" type="submit" <?php if($e10==1 and $MSA<>1){?>disabled<?php }?>><i class="fa fa-plus"></i></button>
                                        </div>
                                    </td>
                                </tr>
                            </form>
                            <?php $sql=mysqli_query($conn, "select * from genel where ne='kargo' order by s10 asc"); while($rs=mysqli_fetch_assoc($sql)){ ?>
                                <form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=duzenle&id=<?php echo $rs["id"];?>" id="xf<?php echo $rs["id"];?>" name="xf<?php echo $rs["id"];?>">
                                    <input type="hidden" value="kargo" name="ne">
                                    <tr class="btr mdfx">
                                        <td class="">
                                            <input type="text" name="t1" size="20" value="<?php echo $rs["t1"];?>" title="<?php echo translate("#Sevkiyat Firma(lar)")?>" class="with-tip form-control">
                                        </td>
                                        <?php if($module["f3_location"]=="1"){?>
                                            <td class="mdn">
                                                <select id="ulke<?php echo $rs["id"];?>" name="t2" class="v3-form-control v3-input-sm" style=""></select>
                                            </td>
                                            <td class="mdn">
                                                <select name="t3" id="il<?php echo $rs["id"];?>" class="form-control"></select>
                                            </td>
                                            <script type="text/javascript">
                                                jQuery(document).ready(function() {
                                                    jQuery('#ulke<?php echo $rs["id"];?>').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=ulke&sID=<?php if($rs["t2"]<>""){echo $rs["t2"];}else{echo $module["countrycode"];}?>');
                                                    jQuery('#il<?php echo $rs["id"];?>').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=bolge&ID=<?php if($rs["t2"]<>""){echo $rs["t2"];}else{echo $module["countrycode"];}?>&sID=<?php echo v3e($rs["t3"])?>');
                                                });
                                                jQuery('#ulke<?php echo $rs["id"];?>').on('change', function(){
                                                    var ID = jQuery('#ulke<?php echo $rs["id"];?> option:selected').attr('ID');
                                                    jQuery('#il<?php echo $rs["id"];?>').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=bolge&ID='+ID);
                                                })
                                            </script>
                                        <?php }?>
                                        <td class="mdn">
                                            <input type="text" name="s10" size="1" value="<?php echo $rs["s10"];?>" title="sıra" class="with-tip form-control">
                                        </td>
                                        <td class="">
                                            <div class="input-group-btn">
                                                <button type="button" tabindex="-1" class="btn btn-warning  mr2 mmr2" id="b<?php echo $rs["id"];?>" onclick="Ajaxs('<?php echo $rs["id"];?>','#result','AjaxPost');" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-refresh"></i></button>
                                                <?php if($e10==1 and $MSA<>"1"){?>
                                                    <button type="button" tabindex="-1" class="btn btn-warning mr2 mmr2" id=""><i class="fa fa-lock" aria-hidden="true"></i> <span class="mdn"> <?php echo $sdil[216]; //Yetkili Değilsiniz ??></span></button>
                                                <?php }else{?>
                                                    <button type="button" tabindex="-1" class="btn btn-info mfrm mr2 mmr2" data-toggle="modal" data-target="#myModal" data-url="../ecommerce/ecommerce_delivery.php?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-pencil"></i></button>
                                                    <button type="button" tabindex="-1" class="btn btn-danger" onclick="location.href='?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $rs["id"];?>&durum=sil'" <?php if($e10==1 and $MSA<>"1"){?>disabled<?php }?>><i class="fa fa-times"></i></button>
                                                <?php }?>
                                            </div>
                                        </td>
                                    </tr>
                                </form>
                                <script>
                                    jQuery(document).ready(function() {
                                        jQuery('#ulke<?php echo $rs["id"];?>').load('<?php echo findDirectoryPath("deppo")?>/tools/script/location.php?ne=ulke&sID=<?php if($rs["t2"]<>""){echo $rs["t2"];}else{echo $module["countrycode"];}?>');
                                    });
                                </script>
                            <?php }?>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
</html>
<?php
echo $footer;
if($_GET["durum"]=="ekle"){
    $ayir = explode(',',$_POST["t1"]);
    $sql = $conn->query("insert into genel(t1,t2,t3,ne,s10) values ('".$_POST["t1"]."', '".$_POST["t2"]."', '".$_POST["t3"]."', '".$_POST["ne"]."', '".$_POST["s10"]."')");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok_1",self,0,0);

}elseif($_GET["durum"]=="duzenle"){
    $Rs = mysqli_query($conn, "update genel set t1='".$_POST["t1"]."', t2='".$_POST["t2"]."', t3='".$_POST["t3"]."', s10='".$_POST["s10"]."' where id=".$_GET["id"]."");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok_1",self,0,0);

}elseif($_GET["durum"]=="sil"){
    $sql = mysqli_query($conn, "delete from genel where id=".$_GET["id"]."");
    $sql = mysqli_query($conn, "delete from genel where ne='desi' and s1=".$_GET["id"]."");
    echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok_1",self,0,0);
}
?>