<?php
require '../../connect.php';

session_start();
$type=$_SESSION['title'];
$id=$_REQUEST['id'];

$stmt = $con->prepare("SELECT * FROM `languages` where id='$id'"); 
$stmt->execute(); 
$row = $stmt->fetch();

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <style>
    .card {
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    margin: 20px auto;
    max-width: 800px;
}

.card-header {
    background-color: deepPink;
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
	height:40px;
}

.backbtn {
    margin-left: auto; /* Push the back button to the right */
}

.card-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px; /* Add margin between form groups */
}

.col-sm-2 {
    flex: 0 0 30%; /* Adjust width of labels */
    max-width: 30%;
}

.col-sm-4 {
    flex: 0 0 70%; /* Adjust width of input fields */
    max-width: 70%;
}

.btn-success {
    background-color: pink;
    border-radius: 6px;
    height: 30px;
    width: 100px;
    font-size: 18px;
	border:none;
}

.btn-success:hover {
    background-color: deepPink;
    color: white;
}
.backbtn
	{
		     color: white;
    background-color: gray;
    padding: 5px 10px;
    border: none;
    font-size: 18px;
    height: 20px;
    cursor: pointer;
    text-decoration: none;

	}
	.backbtn:hover {
        background-color: black; /* Black hover background color */
    }
</style>

</head>
<body><br><br>

 <div class="card card-pink">
              <div class="card-header">
                <h3 class="card-title"><font size="5"><b>Edit Language Name</B></h3>
				
				<div class="backbtn">
            <a onclick="return back()" style="float: right;color:white" data-toggle="modal" class="btn btn-dark"><b>Back</b></a>
			</div>
			
			
              </div>
              <!-- /.card-header -->
              <!-- form start -->
<form role="form" name="" action="" method="post" enctype="multipart/type">
        <div class="card-body">
            <div style="display:flex;justify-content:space-evenly;">
                <label for="music_director_name" class="col-sm-2 col-form-label" style="">Music Director : </label>
                <div class="col-sm-4">
                    <input type="hidden" class="form-control" id="get_id" name="get_id" value="<?php echo $row['id']; ?>">
                    <input type="text" class="form-control" name="music_director_name" id="music_director_name" value="<?php echo $row['language_name'];?>">
                </div>
            </div>
            <br>
            <div style="display:flex;justify-content:space-evenly;">
                <label for="status" class="col-sm-2 col-form-label" style="">Active/Inactive: </label>
                <div class="col-sm-4">
    <select class="form-control" name="status" id="status">
        <option value="active" <?php if ($row['status'] == 'active') echo 'selected'; ?>>Active</option>
        <option value="inactive" <?php if ($row['status'] == 'inactive') echo 'selected'; ?>>Inactive</option>
    </select>
</div>

            </div>
            <br>
            <div style="display:flex;justify-content:center;"> <!-- Adjust alignment of the Update button -->
                <input type="button" class="btn btn-success btn-md" style="" name="Update" onclick="language_update()" value="Update"> 
            </div>
        </div>
    </form>
            </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 back()
{
  var rightcontent=$("#rightcontent").hide();

$.ajax({
type:"POST",
url:"/rythm/professional_singer/language/language_shows.php",
success:function(data){
  $("#centerconteid").css("marginLeft", "450px");
               $("#centerconteid").html(data);
}
})
}
 function language_update(id)
    {
    
	//alert(id);
    var data = $('form').serialize();
	//alert(data);
    $.ajax({
    type:'GET',
    data:"id="+id, data,
    url:'/rythm/professional_singer/language/language_update.php',
    success:function(data)
    {
        alert("Language Name Update Successfully");
        window.location.href = "/rythm/homee.php";
     
    }       
    });
    }
</script>
</body>
</html>
