Eklenmiş olan bir firmanın değiştirme ve düzenlenmesini yapıyorum ama komple silemiyorum. bildiri geliyor silinecek diye ama silinmiyor.
<div class="container">
<div class="row">
<div class="col-sm-12">
<?php if($sayfalandir_url):?>
<div class="text-center"><?php echo $sayfalandir_url?></div><br />
<?php endif?>
<div class="well well-sm">
<h4 class="ust-baslik">Firmalar</h4>
<?php if($firmalar):?>
<table class="table table-striped table-bordered liste-table">
<tr>
<th>ID</th>
<th style="min-width:150px">Tarih</th>
<th>Firma</th>
<th colspan="2">Ekleyen</th>
<th>Sektör</th>
<th>İşlemler</th>
</tr>
<?php while($row = $db->assoc($firmalar) ): extract($row)?>
<tr>
<td><span id="id<?php echo $firma_id?>"><?php echo $firma_id?></span></td>
<td><?php echo date('d.m.Y H:i', $firma_tarih)?></td>
<td><span id="fad<?php echo $firma_id?>"><?php echo $firma_ad?></span></td>
<td><span id="f<?php echo $firma_id?>"><?php echo $uye_ad.' '.$uye_soyad?></span></td>
<td><span data-uye="<?php echo $firma_uye?>" data-firma="<?php echo $firma_id?>" class="btn btn-default uye-degis"><span class="glyphicon glyphicon-edit"></span></span></td>
<td style="max-width:200px">
<?php
$sektor = sektor($firma_id);
if($sektor):?>
<select class="form-control">
<?php foreach($sektor['ust'] as $key=> $v):?>
<optgroup label="<?php echo $v?>">
<?php if(isset($sektor[$key]) ):?>
<?php foreach($sektor[$key] as $ky=> $vk):?>
<option><?php echo $vk?></option>
<?php endforeach?>
<?php endif?>
</optgroup>
<?php endforeach?>
</select>
<?php endif?>
</td>
<td style="min-width:200px">
<?php
if($firma_durum) {
$durum_icon = 'bullhorn';
$durum_btn = 'success';
} else {
$durum_icon = 'lock';
$durum_btn = 'danger';
}
?>
<a href="<?php echo SITE_URL?>firma-ekle/<?php echo $firma_id?>/panel/" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a>
<a href="<?php echo SITE_URL?>firma/<?php echo $firma_id.'/'.$firma_seo?>/" target="_blank" class="btn btn-info"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span></a>
<span data-id="<?php echo $firma_id?>" class="btn btn-<?php echo $durum_btn?> firma_durum"><span class="glyphicon glyphicon-<?php echo $durum_icon?>" aria-hidden="true"></span></span>
<span data-id="<?php echo $firma_id?>" class="btn btn-danger firma_sil"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></span>
</td>
</tr>
<?php endwhile?>
</table>
<div id="uye-degis">
<div>
<input type="hidden" id="firma-id">
<input type="hidden" id="uye-id">
<div id="firma-bilgi" class="text-center"></div>
<div id="uye-bilgi" class="text-center"></div>
<div class="form-group">
<div class="input-group">
<label class="input-group-addon">Üye Ara</label>
<input type="text" id="uye_ara" class="form-control">
<a href="javascript:void(0)" class="input-group-addon uye-kapat">X</a>
</div>
</div>
<table class="table table-striped table-bordered table-hover" style="background:#fff">
<tr>
<th>Uye İd</th>
<th>Üye</th>
<th>Üye Mail</th>
<th>İşlem</th>
</tr>
<tbody id="tbody">
<tr>
<td>Uye İd</td>
<td>Üye</td>
<td>Üye Mail</td>
<td>işlem</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php endif?>
</div>
<?php if($sayfalandir_url):?>
<div class="text-center"><?php echo $sayfalandir_url?></div>
<?php endif?>
</div>
</div>
<!-- //container -->
</div>
<script>
function sec(id, th) {
$("#uye-bilgi").html("");
var firmid = $("#firma-id").val();
var isim = $("#f"+firmid).html();
var yeniisim = $(th).attr('data-ad');
$("#uye-bilgi").html("<span>"+isim+" -> </span>");
$("#uye-bilgi").append("<span>"+yeniisim+" ile değiştir</span>");
$("#uye-bilgi").append('<span id="degis-button" class="btn btn-success" data-id="'+id+'" data-ad="'+yeniisim+'" onclick="degis(this)">Değiştir</span>');
}
$("#uye_ara").keyup(function(e) {
var ara = $(this).val();
ara = encodeURIComponent(ara);
var fd = "uye_ara="+ara;
$.ajax({
url: "",
cache: false,
type: "GET",
data: fd,
}).done(function( c ) {
$("#tbody").html("");
if(c) {
$("#tbody").html(c);
//console.log(c);
}
});
});
$(".uye-degis").click(function() {
$("#firma-bilgi").html("");
$("#firma-id").val("");
$("#uye-id").val("");
var firmid = $(this).attr("data-firma");
var firmaad = $("#fad"+firmid).html();
var id = $("#id"+firmid).html();
var uid = $(this).attr("data-uye");
$("#uye-id").val(uid);
$("#firma-id").val(id);
$("#firma-bilgi").html(firmaad+" için");
$("#uye-degis").fadeIn(500);
});
$(".uye-kapat").click(function() {
$("#uye-degis").fadeOut(500);
});
function degis(th) {
var id = $("#firma-id").val();
var uye_id = $("#uye-id").val();
var y_id = $(th).attr("data-id");
var isim = $(th).attr("data-ad");
if(uye_id == y_id ) {
alert("Farklı Üye Seçmediniz");
return false;
} else {
var fd = "uyedegis="+y_id+'&fid='+id;
$.ajax({
url: "",
cache: false,
type: "GET",
data: fd,
}).done(function( c ) {
if(c) {
//$("#tbody").html(c);
$("#f"+id).html(isim);
alert(c);
$("#uye-degis").fadeOut(500);
}
});
}
};
// sil
$(".firma_sil").click(function() {
var txt;
var r = confirm("İşlemin Geri Dönüşü Yoktur, Emin misiniz?");
if (r == true) {
alert("Silinecek");
}
});
$(".firma_durum").click(function() {
var th = $(this);
var id = $(this).attr("data-id");
var fd = "firma_durum="+id;
$.ajax({
url: "",
cache: false,
type: "GET",
data: fd,
}).done(function( c ) {
if(c) {
if( c == 0 ) {
th.removeClass('btn-success').addClass('btn-danger');
th.children().removeClass('glyphicon-bullhorn').addClass('glyphicon-lock');
} else if( c == 2 ) {
alert("İşlem Gerçekleştirilemedi");
} else {
th.addClass('btn-success').removeClass('btn-danger');
th.children().removeClass('glyphicon-lock').addClass('glyphicon-bullhorn');
}
}
});
});
</script>