Skip to content

Commit

Permalink
member
Browse files Browse the repository at this point in the history
  • Loading branch information
MatAsmat committed Jul 24, 2021
1 parent 2fc9aee commit 6fe3ad2
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 15 deletions.
31 changes: 31 additions & 0 deletions admin/create_type_ttag.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,37 @@
<textarea name="TreeBreedPropagation" class="form-control" rows="1" placeholder="ป้อน . . ."></textarea>
</div>
</div>
<div class="col-sm-6">
<!-- text input -->
<div class="form-group">
<label for="exampleInputFile">ระดับการดูแลน้ำ</label>
<div class="input-group">
<div class="custom-file">
<input type="file" name="TemplateFrontImage" class="custom-file-input" required
id="exampleInputFile" eccept="image/*">
<label class="custom-file-label" for="exampleInputFile">เลือกรูปภาพ</label>
</div>
<div class="input-group-append">
<span class="input-group-text" id="">อัพโหลด</span>
</div>
</div>
</div>
</div> <div class="col-sm-6">
<!-- text input -->
<div class="form-group">
<label for="exampleInputFile">ระดับการดูแลแสง</label>
<div class="input-group">
<div class="custom-file">
<input type="file" name="TemplateBackImage" class="custom-file-input" required
id="exampleInputFile" eccept="image/*">
<label class="custom-file-label" for="exampleInputFile">เลือกรูปภาพ</label>
</div>
<div class="input-group-append">
<span class="input-group-text" id="">อัพโหลด</span>
</div>
</div>
</div>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
Expand Down
32 changes: 30 additions & 2 deletions admin/create_type_ttag_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
$TreeBreedWarning = $_POST["TreeBreedWarning"];
$TreeBreedFertilize = $_POST["TreeBreedFertilize"];
$TreeBreedPropagation = $_POST["TreeBreedPropagation"];
$date = date("Ymd_His");
$numrand = (mt_rand());
$TreeWaterImg = (isset($_POST['TreeWaterImg']) ? $_POST['TreeWaterImg'] : '');
$upload=$_FILES['TreeWaterImg']['name'];
if($upload !='') {
$path="./image/water_sunlight/";
$type = strrchr($_FILES['TreeWaterImg']['name'],".");
$newname =$numrand.$date.$type;
$path_copy=$path.$newname;
$path_link="./image/water_sunlight/".$newname;
move_uploaded_file($_FILES['TreeWaterImg']['tmp_name'],$path_copy);
}
$date2 = date("Ymd_His");
$numrand2 = (mt_rand());
$TreeSunLightImg = (isset($_POST['TreeSunLightImg']) ? $_POST['TreeSunLightImg'] : '');
$upload2=$_FILES['TreeSunLightImg']['name'];
if($upload2 !='') {
$path2="./image/water_sunlight/";
$type2 = strrchr($_FILES['TreeSunLightImg']['name'],".");
$newname2 =$numrand2.$date2.$type;
$path_copy2=$path2.$newname2;
$path_link2="./image/water_sunlight/".$newname2;
move_uploaded_file($_FILES['TreeSunLightImg']['tmp_name'],$path_copy2);
}

$check = "
SELECT TreeBreedName
Expand All @@ -32,7 +56,9 @@
TreeBreedDisease,
TreeBreedWarning,
TreeBreedFertilize,
TreeBreedPropagation
TreeBreedPropagation,
TreeWaterImg,
TreeSunLightImg
)
VALUES
(
Expand All @@ -41,7 +67,9 @@
'$TreeBreedDisease',
'$TreeBreedWarning',
'$TreeBreedFertilize',
'$TreeBreedPropagation'
'$TreeBreedPropagation',
'$newname',
'$newname2'
)";

$result = mysqli_query($condb, $sql) or die ("Error in query: $sql " . mysqli_error());
Expand Down
Binary file added images/icon/bird.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon/cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon/dog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon/heart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon/plant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 75 additions & 8 deletions member/dtag/create_info_dtag.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,28 @@
include('include_header.php');
?>
<main>
<div class="modal fade" id="deleteInfo1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">ลบข้อมูลน้ำหนักสัตว์เลี้ยง</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="delete_member_dog_weight_db.php" method="POST">
<div class="modal-body">
<input type="hidden" name="delete_id" id="delete_id">
<h4>คุณต้องการลบข้อมูลนี้ จริงหรือ?</h4>
</div>
<div class="modal-footer">
<button type="submit" name="deletedata" class="btn btn-primary">ใช่ !!! ลบข้อมูลนี้</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">ไม่ใช่</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="editInfo1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
Expand All @@ -128,19 +150,20 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<form>
<form action="update_member_dog_weight_db.php" method="POST">
<div class="modal-body">
<input type="hidden" name="update_id" id="update_id">
<div class="form-group">
<label>วันที่</label>
<input type="date" name="" class="form-control">
<input type="date" name="DogWeightDate" id="DogWeightDate" class="form-control">
</div>
<div class="form-group">
<label>น้ำหนัก</label>
<input type="number" name="" class="form-control" placeholder="ป้อนข้อมูล...">
<input type="number" name="DogWeight" id="DogWeight" class="form-control" placeholder="ป้อนข้อมูล...">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">แก้ไข</button>
<button type="submit" name="updatedata" class="btn btn-primary">แก้ไข</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">กลับ</button>
</div>
</form>
Expand Down Expand Up @@ -197,6 +220,7 @@
<thead>
<tr align='center'>
<th>#</th>
<th>ลำดับ</th>
<th>วันที่</th>
<th>kg</th>
<th>วันที่บันทึก</th>
Expand All @@ -210,18 +234,18 @@
$item +=1;
echo "<tr align='center'>";
echo "<td>".$item.'.'. "</td>";
echo "<td>" .$row["DogWeightID"] . "</td> ";
echo "<td>" .$row["DogWeightDate"] . "</td> ";
echo "<td>" .$row["DogWeight"] . "</td> ";
echo "<td>" .$row["DateSave"] . "</td> ";
echo "<td class='project-actions text-center'>
<a href='#editbtn1$ID' class='btn btn-info btn-sm'> <i class='fas fa-pencil-alt'>
</i> แก้ไข</a></td> ";
echo "<td>
<button type='button' class='btn btn-primary editbtn1'>Edit</button>
</td> ";
echo "<td>
<button type='button' class='btn btn-danger'>Delete</button>
<button type='button' class='btn btn-danger deletebtn1'>Delete</button>
</td> ";
echo "</tr>";


}
echo "</table>";
Expand Down Expand Up @@ -960,12 +984,55 @@
$(document).ready(function() {
$('.editbtn1').on('click', function() {
$('#editInfo1').modal('show');

$tr = $(this).closest('tr');

var data = $tr.children("td").map(function() {
return $(this).text();
}).get();

console.log(data);

$('#update_id').val(data[0]);
$('#DogWeightDate').val(data[1]);
$('#DogWeight').val(data[2]);

});
});

$(document).ready(function() {
$('.deletebtn1').on('click', function() {
$('#deleteInfo1').modal('show');

$tr = $(this).closest('tr');

var data = $tr.children("td").map(function() {
return $(this).text();
}).get();

console.log(data);

$('#delete_id').val(data[0]);


});
});

$(document).ready(function() {
$('.editbtn2').on('click', function() {
$('#editInfo2').modal('show');

$tr = $(this).closest('tr');

var data = $tr.children("td").map(function() {
return $(this).text();
}).get();

console.log(data);

$('#DogWeightID').val(data[0]);
$('#DogWeightDate').val(data[1]);
$('#DogWeight').val(data[2]);
});
});

Expand Down
25 changes: 25 additions & 0 deletions member/dtag/delete_member_dog_weight_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<meta charset="utf-8">
<?php
include('../../condb.php');

if(isset($_POST['deletedata'])) {

$DogWeightID = $_POST['delete_id'];

$query = "DELETE FROM tbl_member_dog_weight WHERE DogWeightID ='$DogWeightID'";
$result = mysqli_query($condb, $query);

if($result){
echo "<script type='text/javascript'>";
echo "alert('ลบข้อมูลสำเร็จ');";
echo "window.history.back();";
echo "</script>";
}else{
echo "<script type='text/javascript'>";
echo "alert('Error!!');";
echo "window.history.back();";
echo "</script>";
}
}

?>
35 changes: 35 additions & 0 deletions member/dtag/update_member_dog_weight_db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<meta charset="utf-8">
<?php
//condb
include('../../condb.php');

if(isset($_POST['updatedata'])) {

$DogWeightDate = $_POST["DogWeightDate"];
$DogWeight = $_POST["DogWeight"];
$DogWeightID = $_POST["DogWeightID"];

$sql = "UPDATE tbl_member_dog_weight SET
DogWeightDate='$DogWeightDate',
DogWeight='$DogWeight'
WHERE DogWeightID=$DogWeightID
";


$result = mysqli_query($condb, $sql) or die ("Error in query: $sql " . mysqli_error());

mysqli_close($condb);

if($result){
echo "<script type='text/javascript'>";
echo "alert('เพิ่มข้อมูลสำเร็จ');";
echo "window.history.back();";
echo "</script>";
}else{
echo "<script type='text/javascript'>";
echo "alert('Error!!');";
echo "window.history.back();";
echo "</script>";
}
}
?>
8 changes: 8 additions & 0 deletions member/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
</span></button>
</div>
<div class="card-body">
<div style="text-align:center">
<img src="../images/icon/dog.png" alt="" width="49px">
<img src="../images/icon/cat.png" alt="" width="49px">
<img src="../images/icon/plant.png" alt="" width="49px">
<img src="../images/icon/bird.png" alt="" width="49px">
<img src="../images/icon/fish.png" alt="" width="49px">
<img src="../images/icon/heart.png" alt="" width="49px">
</div>
<?php
$query = " SELECT * FROM tbl_owner as o
INNER JOIN tbl_dog as d ON d.Ref_OwnerID = o.OwnerID
Expand Down
4 changes: 2 additions & 2 deletions member/ttag/create_info_ttag.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@
<thead>
<tr align='center'>
<th>#</th>
<th>วันที่</th>
<th>หมายเหตุ</th>
<th>วันที่บันทึก</th>
<th>แก้ไข</th>
Expand All @@ -412,7 +411,6 @@
echo "<td>
<button type='button' class='btn btn-danger'>Delete</button>
</td> ";

}
echo "</table>";
echo "</div>";
Expand All @@ -432,6 +430,8 @@
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script> -->

<script>


$(document).ready( function () {
$('#myTable').DataTable();
$('#myTable2').DataTable();
Expand Down
6 changes: 3 additions & 3 deletions member/ttag/profile_tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
<div class="flip-card-front">
<img class="img-front" src="./../../admin/image/templates/<?php echo $row['TemplateFrontImageSample'];?>" width="250px" alt="template">
<div class="data-ft">
<p><?php echo $TreeName;?></p>
<p><?php echo $TreeBreedName;?></p>
<p><?php echo $TreeBreedName;?></p>
<p><?php echo $TreeName .' '. $TreeBreedName;?></p>
<p><?php echo $waterimg;?></p>
<p><?php echo $sunligntimg;?></p>
</div>
</div>
<div class="flip-card-back">
Expand Down

0 comments on commit 6fe3ad2

Please sign in to comment.