
<?php
require ('../../connect.php');
session_start();
$type=$_SESSION['title'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<style>

 td {
      font-size: 20px;
    }
    .status-active {
      color: green;
    }

    .status-inactive {
      color: red;
    }
/* Table Styles */
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

th {
  background-color: deeppink; /* Deep Pink Background for Table Header */
  color: white; /* White Text Color for Table Header */
}

/* Status Styles */
.status-active {
  color: green;
}

.status-inactive {
  color: red;
}

/* Button Styles */
.btn {
  padding: 8px 12px;
  background-color: gray;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  float:right;
  transition: background-color 0.3s;
}

.btn-danger {
  background-color: red;
}

.btn:hover {
  background-color:black;
}

.btn-icon {
  margin-right: 5px;
}

/* Card Styles */
.card {
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 5px;
  margin: 20px auto;
  padding: 20px;
  max-width: 800px; /* Adjust as needed */
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 24px;
  margin: 0;
  color: deeppink; /* Deep Pink Color for Card Title */
}

.card-body {
  padding: 0;
}

</style>

</head>
<body>


<div class="card card-pink">
  <div class="card-header">
    <h3 class="card-title" style="font-size: 24px;"><b>Language List</b></h3>
    <a onclick="add()" style="float: right;color:white" data-toggle="modal" class="btn btn-dark"><b>Add New Language</b></a>
  </div>
  <br>
  <div class="card card-dark">
    <div class="card-body">
      <table id="example1" class="table table-bordered table-striped">
        <thead>
          <tr>
            <th>S.NO</th>
            <th>LANGUAGE Name</th>
            <th>STATUS</th>
            <th>ACTION</th>
          </tr>
        </thead>
        <tbody>
          <?php
          $sql = $con->query("SELECT * FROM `languages` where singer_type='$type' ORDER BY language_name ASC");
          $cnt = 1;
          while ($empdetails = $sql->fetch(PDO::FETCH_ASSOC)) {
           // $statusClass = ($empdetails['status'] == 'active') ? 'status-active' : (($empdetails['status'] == 'inactive') ? 'status-inactive' : '');
            ?>
          
          <tr>
            <td><?php echo $cnt; ?></td>
            <td><?php echo ucfirst($empdetails['language_name']); ?></td>
            <td><?php echo ucfirst($empdetails['status']);  ?></td>
            <td style="display:flex;justify-content:center;gap:20px;">
              <button class="btn btn-success btn-sm" data-id="<?php echo $empdetails['id']; ?>" onclick="language_edit(<?php echo $empdetails['id']; ?>)" style="background-color:green;">&nbsp;&nbsp;<i class="fa fa-edit btn-icon"></i>&nbsp;Edit</button>
              <button class="btn btn-danger btn-sm" data-id="<?php echo $empdetails['id']; ?>" onclick="language_delete(<?php echo $empdetails['id']; ?>)"style="background-color:red;">&nbsp;&nbsp;<i class="fa fa-trash btn-icon"></i>&nbsp;Delete</button>
            </td>
          </tr>
          <?php
            $cnt = $cnt + 1;
          }
          ?>
        </tbody>
      </table>
    </div>
  </div>

</div>


<div class="footerlabeel" style="display:flex;justify-content:space-between;margin-top:600px;">
    <label class="lableoffooter" style="font-size:18px;">©&nbspAll&nbsprights&nbspreserved&nbsp@2024</label><br>
    <label class="lableoffooter" style="font-size:18px;">Developed&nbspand&nbspMaintained&nbspby&nbspBluebase&nbspSoftware&nbspServices&nbspPrivate&nbspLimited</label>
</div>
<br><br>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>
 
  function add()
	{
    var rightcontent=$("#rightcontent").hide();
		$.ajax({
		type:"POST",
		 url:"/rythm/professional_singer/language/language_add.php",
		success:function(data){
      $("#centerconteid").css("marginLeft", "450px");
               
               $("#centerconteid").html(data);
		}
		})
	}

  function language_edit(v){
    var rightcontent=$("#rightcontent").hide();
	//alert(v);
	$.ajax({
	type:"POST",
	url:"/rythm/professional_singer/language/language_edit.php?id="+v,
	
	success:function(data)
	{
    $("#centerconteid").css("marginLeft", "450px");
               
               $("#centerconteid").html(data);
	}
	})
}


  function language_delete(v){
    var rightcontent=$("#rightcontent").hide();
	//alert(v);
	$.ajax({
	type:"POST",
	url:"/rythm/professional_singer/language/language_delete.php?id="+v,
	
	success:function(data)
	{
		if(data==1)
      { 
        alert('Not');
      
      }
     else
     {
        alert("Music Director Record Deleted Successfully");
        window.location.href = "/rythm/homee.php";
      }
      
	}
	})
}
  
</script>
</body>
</html>
