<?php
include "config/conn.php";
if($_POST['btncari']=="Search") {
	$tglf=$_POST['tglf'];
	$tgls=$_POST['tgls'];
} else { 
	$tglf= date('Y-m-d');
	$tgls = date('Y-m-d',strtotime('-1 day',strtotime($tglf))) ;
}
if($_SESSION['id_bbws']==8) {$idbbws="IN ('8','21','23')";} else {$idbbws="IN ('".$_SESSION['id_bbws']."')";}
$sql="SELECT
				a.*,
				m_bbws.nama_bbws,
				m_das.nama_das,
				m_provinsi.nama_provinsi,
				m_kota.nama_kota
				FROM
				m_lokasi AS a
				LEFT JOIN m_bbws ON a.id_bbws = m_bbws.id_bbws
				LEFT JOIN m_das ON a.id_das = m_das.id_das
				LEFT JOIN m_provinsi ON a.id_provinsi = m_provinsi.id_provinsi
				LEFT JOIN m_kota ON a.id_kota = m_kota.id_kota 
				WHERE 1=1 AND a.id_bbws ".$idbbws."";
$query=mysql_query($sql);

$queryProvinsi = mysql_query("SELECT * FROM m_provinsi");
$optionProvinsi = '<option value="0">Pilih Provinsi</option>';
while($rowP = mysql_fetch_array($queryProvinsi)){
	$optionProvinsi .= '<option value="'.$rowP['id_provinsi'].'">'.$rowP['nama_provinsi'].'</option>';
}									                                                

$queryKota = mysql_query("SELECT * FROM m_kota");
$optionKota = '<option value="0">Pilih Kota</option>';

if($_POST['simpan']=="Simpan"){
		$idlokasi=strip_tags($_POST['idlokasi']);
    	$kode_lokasi=strip_tags($_POST['kode_lokasi']);
		$nama_alat=strtolower($_POST['nama_alat']);
		$nama_lokasi=trim($_POST['nama_lokasi']);
		$ibbws=strip_tags($_POST['ibbws']);
		$idas=strip_tags($_POST['idas']);
		$ildas=strip_tags($_POST['ildas']);
		$iprov=strip_tags($_POST['iprov']);
		$ikota=strip_tags($_POST['ikota']);
		$kd=strip_tags($_POST['kd']);
        $itype=strip_tags($_POST['itype']);
        $imerk=strip_tags($_POST['imerk']);
        $lat=strip_tags($_POST['lat']);
        $lng=strip_tags($_POST['lng']);
        $thn_bangun=strip_tags($_POST['thn_bangun']);
        $pengamat=strip_tags($_POST['pengamat']);
    	$siaga4=strip_tags($_POST['siaga4']);
    	$siaga3=strip_tags($_POST['siaga3']);
    	$siaga2=strip_tags($_POST['siaga2']);
    	$siaga1=strip_tags($_POST['siaga1']);
    	$tlp=strip_tags($_POST['tlp']);
    	$kalibrasi=strip_tags($_POST['kalibrasi']);
    	$statuslokasi=strip_tags($_POST['statuslokasi']);
    	$foto=strip_tags($_POST['filependukung']);
		$fileName = trim($_FILES['filependukung']['name']);
	 	
		if($itype=="PDA"){ $icon="pda"; } else { $icon="pch";}
		if ($idlokasi=="") {
		   	$sqlinsertmlokasi="INSERT INTO m_lokasi values('','$kode_lokasi','$tlp','$ibbws','$nama_lokasi','$idas','$ildas','$iprov','$ikota','$lat','$lng','$thn_bangun','','$itype','$imerk','$pengamat','$icon','$siaga1','$siaga2','$siaga3','$siaga4','','','','','','','1','$fileName','$kd','$nama_alat','','','','','','')";
		    $query=mysql_query($sqlinsertmlokasi);
			if($query){ 
			move_uploaded_file($_FILES['filependukung']['tmp_name'], "gambarpos/".$fileName);

				//SQL CREATE TABLE
				$sql_table = "CREATE TABLE $nama_lokasi (Id int NOT NULL AUTO_INCREMENT, 
														 ReceivedDate date NOT NULL, 
													   ReceivedTime time NOT NULL , 
													   SamplingDate date NOT NULL ,
													   SamplingTime time NOT NULL ,
													   Rain float(11) NOT NULL, 
													   WLevel float(11),
													   ML int(11),
													   PRIMARY KEY (Id)
													   )";
				$query_table=mysql_query($sql_table);
				// AKHIR CREAT TABLE

				if($itype=='PCH'){
				//SQL CREATE TRIGGER
				$sql_trigger ="CREATE TRIGGER u_$nama_lokasi BEFORE INSERT ON $nama_lokasi
						  		FOR EACH ROW 
						  		BEGIN
							      SET @5hari = (SELECT CURDATE() - INTERVAL 2 DAY);
						         	IF NEW.ReceivedDate <= @2hari THEN
							            SET @icon = 'mati';      
							            UPDATE m_lokasi SET
							            ReceivedDate=New.ReceivedDate,
							            ReceivedTime=New.ReceivedTime,
							            SamplingDate=New.SamplingDate,
							            SamplingTime=New.SamplingTime,
							            Rain=New.Rain,
							            WLevel=New.WLevel,
							            icon=@icon
							            WHERE nama_lokasi='$nama_lokasi';
							         END IF;

							        IF NEW.Rain > 0 THEN
							               IF NEW.ReceivedDate = CURDATE() THEN
							               SET @icon = 'berawan';
							                  IF NEW.Rain > 0 && NEW.Rain <= $siaga4 THEN
							                     SET @icon = 'berawan'; 
							                     ELSEIF NEW.Rain > $siaga4 && NEW.Rain <= $siaga3 THEN  
							                     SET @icon = 'ringan'; 
							                     ELSEIF NEW.Rain > $siaga3 && NEW.Rain <= $siaga2 THEN  
							                     SET @icon = 'sedang'; 
							                     ELSEIF NEW.Rain > $siaga1 THEN  
							                     SET @icon = 'lebat';   
							                  END IF;
							               END IF;

							            UPDATE m_lokasi SET
							            ReceivedDate=New.ReceivedDate,
							            ReceivedTime=New.ReceivedTime,
							            SamplingDate=New.SamplingDate,
							            SamplingTime=New.SamplingTime,
							            Rain=New.Rain,
							            WLevel=New.WLevel,
							            icon=@icon
							            WHERE nama_lokasi='$nama_lokasi';
							        END IF;
							END
						";

} else if($itype=='PDA') { 
				$sql_trigger ="CREATE TRIGGER u_$nama_lokasi BEFORE INSERT ON $nama_lokasi
						  FOR EACH ROW 
						  BEGIN
							      SET @5hari = (SELECT CURDATE() - INTERVAL 2 DAY);
							         IF NEW.ReceivedDate <= @2hari THEN
							            SET @icon = 'mati';      
							            UPDATE m_lokasi SET
							            ReceivedDate=New.ReceivedDate,
							            ReceivedTime=New.ReceivedTime,
							            SamplingDate=New.SamplingDate,
							            SamplingTime=New.SamplingTime,
							            Rain=New.Rain,
							            WLevel=New.WLevel,
							            icon=@icon
							            WHERE nama_lokasi='$nama_lokasi';
							         END IF;

							        IF NEW.WLevel > 0 THEN
							               IF NEW.ReceivedDate = CURDATE() THEN
							               SET @icon = 'siaga4';
							                  IF NEW.WLevel > 0 && NEW.WLevel <= $siaga4 THEN
							                     SET @icon = 'siaga4'; 
							                     ELSEIF NEW.WLevel > $siaga4 && NEW.WLevel <= $siaga3 THEN  
							                     SET @icon = 'siaga3'; 
							                     ELSEIF NEW.WLevel > $siaga3 && NEW.WLevel <= $siaga2 THEN  
							                     SET @icon = 'siaga2'; 
							                     ELSEIF NEW.WLevel > $siaga1 THEN  
							                     SET @icon = 'siaga1';   
							                  END IF;
							               END IF;

							            UPDATE m_lokasi SET
							            ReceivedDate=New.ReceivedDate,
							            ReceivedTime=New.ReceivedTime,
							            SamplingDate=New.SamplingDate,
							            SamplingTime=New.SamplingTime,
							            Rain=New.Rain,
							            WLevel=New.WLevel,
							            icon=@icon
							            WHERE nama_lokasi='$nama_lokasi';
							        END IF;
							END
						";

				}			

				$query_trigger=mysql_query($sql_trigger);
				// AKHIR CREATE TRIGGER
			}

			echo"<script>alert('Data pos berhasil disimpan !');history.go(-1);</script>";

		} else {

			$sql="UPDATE m_lokasi SET kode_lokasi='$kode_lokasi',no_hp='$tlp',
							 ws='$ildas',lat='$lat',lng='$lng', lokasi_alamat='$kd',nama_alat='$nama_alat',id_provinsi='$iprov'
							 ,id_kota='$ikota' 
							 ,siaga1='$siaga1' 
							 ,siaga2='$siaga2' 
							 ,siaga3='$siaga3' 
							 ,siaga4='$siaga4' 
							 ,id_das='$idas'
							 ,foto_lokasi='$fileName'
							 ,nama_pengamat='$pengamat',
							 kalibrasi='$kalibrasi',
							 status_lokasi='$statuslokasi'
							 WHERE id_lokasi='$idlokasi'";			

			$query=mysql_query($sql);
			if($query){
				move_uploaded_file($_FILES['filependukung']['tmp_name'], "gambarpos/".$fileName);
				echo"<script>alert('Data pos berhasil disimpan !');history.go(-1);</script>";
			}
		}
}

?>
					<link rel="stylesheet" href="https://cdn.datatables.net/1.11.0/css/dataTables.bootstrap5.min.css">
					<!--//Page Toolbar//-->
                    <div class="toolbar pt-4 px-4 px-lg-8">
                        <div class="position-relative container-fluid px-0">
                            <div class="row align-items-center position-relative">
                                <div class="col-md-7">
                                    <h3 class="mb-2">Lokasi POS </h3>

                                    <!--nav aria-label="breadcrumb">
                                        <ol class="breadcrumb mb-0">
                                            <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                                            <li class="breadcrumb-item active">UI Components</li>
                                            <li class="breadcrumb-item active">Feather Icons</li>
                                        </ol>
                                    </nav-->
                                </div>
                                <div class="col-md-5 text-md-end">
                                  <div class="d-flex justify-content-sm-end align-items-center">
                                    <div class="d-flex align-items-center">
                                      <button type="button" class="btn btn-info mb-2 me-2" data-bs-toggle="modal" data-bs-target="#newform"><i data-feather="plus"></i>&nbsp; Tambah Lokasi POS</button>
                                    </div>
                                  </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--//Page Toolbar End//-->

                    <!--//Page content//-->
                    <div class="content pt-4 px-4 px-lg-8 d-flex flex-column-fluid">
                        <div class="container-fluid px-0">
                            <div class="row">
                                <div class="col-12 mb-4">
                                    <div class="row">
                                        <div class="col-12 mb-4">
                                            <div class="card">
                                                <div class="table-responsive">
					                                <table id="datatable" class="table mt-0 table-striped table-card table-nowrap">
					                                    <thead class="text-uppercase small text-muted">
					                                        <tr>
					                                            <th>Nama POS</th>
					                                            <th>Tipe POS</th>
					                                            <th>Merk</th>
					                                            <th>Sungai</th>
					                                            <th>Kota</th>
					                                            <th>Provinsi</th>
					                                            <th>Tahun Bangun</th>
					                                            <th>Foto</th>
					                                            <th>Aksi</th>
					                                        </tr>
					                                    </thead>
					                                    <tbody>
				                                    	<?php
					                                    while($row=mysql_fetch_array($query)){
					                                    	if($row['tahun_bangun'] == '0'){ $row['tahun_bangun'] = null; }
					                                    	$namaAlat = ucwords(strtolower($row['nama_alat']));
					                                    	$urlFotoLokasi = BASEURL.'gambarpos/'.$row['foto_lokasi'];
					                                    	$tipePos = substr($row['id_tipe'], 0, 3);
					                                    ?>
					                                        <tr>
					                                            <td><?php echo $namaAlat;?></td>
					                                            <td><?php echo $tipePos;?></td>
					                                            <td><?php echo $row['id_merk'];?></td>
					                                            <td><?php echo ucwords(strtolower($row['ws']));?></td>
					                                            <td><?php echo ucwords(strtolower($row['nama_kota']));?></td>
					                                            <td><?php echo ucwords(strtolower($row['nama_provinsi']));?></td>
					                                            <td><?php echo $row['tahun_bangun'];?></td>
					                                            <td>
					                                            	<?php if($row['foto_lokasi'] != ''){ ?>
					                                            		<i class="text-primary" data-feather="image" title="Lihat Foto Lokasi POS <?php echo $namaAlat; ?>" data-bs-toggle="modal" data-bs-target="#displayimage" style="cursor: pointer;" onClick="toDisplayImg('<?php echo $namaAlat; ?>','<?php echo $urlFotoLokasi; ?>')"></i>
					                                            	<?php } ?>
					                                            </td>
					                                            <td>
					                                            	<i class="text-warning" data-feather="edit" data-bs-toggle="modal" data-bs-target="#editform" style="cursor: pointer;" onClick="todetail('<?php echo $row['id_lokasi']; ?>')"></i> &nbsp; 
					                                            	<a href="home.php?page=datapos&pos=<?php echo $row['nama_lokasi']; ?>&tpos=<?php echo $row['id_tipe'];?>" title="Lihat Detail Lokasi POS <?php echo $namaAlat;?>" data-bs-toggle="tooltip" data-bs-placement="left" target="_blank"><i class="text-info" data-feather="cpu"></i></a>
					                                            </td>
					                                        </tr>
					                                    <?php  
					                                	}
					                                    ?>
					                                    </tbody>
					                                </table>
					                            </div>
					                            <!-- New Modal -->
					                            <div class="modal fade" id="newform" data-bs-backdrop="static"
	                                                data-bs-keyboard="false" tabindex="-1"
	                                                aria-labelledby="newformLabel" aria-hidden="true">
	                                                <div class="modal-dialog modal-lg">
	                                                    <div class="modal-content">
	                                                        <div class="modal-header">
	                                                            <h5 class="modal-title" id="editformLabel">Tambah Lokasi POS</h5>
	                                                            <button type="button" class="btn-close"
	                                                                data-bs-dismiss="modal" aria-label="Close"></button>
	                                                        </div>
	                                                        <div class="modal-body">
	                                                            <div class="row">
	                                                            	<div class="col-6">
	                                                            		<div class="row">
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-kodepos" class="form-label">Kode POS</label>
                                                  								<input type="text" class="form-control" id="new-kodepos" name="new-kodepos">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-namaalat" class="form-label">Nama Alat</label>
                                                  								<input type="text" class="form-control" id="new-namaalat" name="new-namaalat">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-namapos" class="form-label">Nama POS</label>
                                                  								<input type="text" class="form-control" id="new-namapos" name="new-namapos" value="">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-tahunbangun" class="form-label">Tahun Bangun</label>
                                                  								<input type="text" class="form-control" id="new-tahunbangun" name="new-tahunbangun">
	                                                            			</div>
	                                                            			<!--div class="col-12 mb-3">
	                                                            				<label for="new-namapos" class="form-label">Balai Besar Wilayah Sungai</label>
                                                  								<input type="text" class="form-control" id="new-namapos" name="new-namapos" value="Citanduy" disabled>
	                                                            			</div-->
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-tipepos" class="form-label">Tipe POS</label>
                                                  								<select class="form-select" aria-label="" id="new-tipepos" name="new-tipepos">
									                                                <option value="PCH">PCH</option>
									                                                <option value="PDA">PDA</option>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-merk" class="form-label">Merk</label>
                                                  								<select class="form-select" aria-label="" id="new-merk" name="new-merk">
									                                                <option value="APTECH">APTECH</option>
									                                                <option value="Campbell">Campbell</option>
									                                                <option value="FEWS">FEWS</option>
									                                                <option value="HIGERTECH">HIGERTECH</option>
									                                                <option value="ICU">ICU</option>
									                                                <option value="KOMTRONIK">KOMTRONIK</option>
									                                                <option value="MANUAL">MANUAL</option>
									                                                <option value="RADIO">RADIO</option>
									                                                <option value="SEBA">SEBA</option>
									                                                <option value="TATONAS">TATONAS</option>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="new-siaga1" class="form-label">Siaga I</label>
                                                  								<input type="text" class="form-control" id="new-siaga1" name="new-siaga1">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="new-siaga2" class="form-label">Siaga II</label>
                                                  								<input type="text" class="form-control" id="new-siaga2" name="new-siaga2">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="new-siaga3" class="form-label">Siaga III</label>
                                                  								<input type="text" class="form-control" id="new-siaga3" name="new-siaga3">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="new-siaga4" class="form-label">Siaga IV</label>
                                                  								<input type="text" class="form-control" id="new-siaga4" name="new-siaga4">
	                                                            			</div>
	                                                            			<!--div class="col-3">
	                                                            				<label for="new-kalibrasi" class="form-label">Kalibrasi</label>
                                                  								<input type="text" class="form-control" id="new-kalibrasi" name="new-kalibrasi">
	                                                            			</div-->
	                                                            			<div class="col-3">
	                                                            				<label for="new-statuslok" class="form-label">Status</label>
                                                  								<select class="form-select" aria-label="" id="edit-statuslok" name="edit-statuslok">
                                                  									<option value="1">Active</option>
                                                  									<option value="0">Inactive</option>
                                                  								</select>
	                                                            			</div>
	                                                            			<div class="col-9 mb-3">
	                                                            				<label for="new-fotolokasi" class="form-label">Foto Lokasi</label>
	                                                            				<input class="form-control" type="file" id="new-fotolokasi" name="new-fotolokasi">
	                                                            			</div>
	                                                            		</div>
	                                                            	</div>
	                                                            	<div class="col-6">
	                                                            		<div class="row">
																			<div class="col-6 mb-3">
	                                                            				<label for="new-provinsi" class="form-label">Provinsi</label>
                                                  								<select class="form-select" aria-label="" id="new-provinsi" name="new-provinsi" onChange="checkKota(this.value)">
									                                            <?php echo $optionProvinsi; ?>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-kota" class="form-label">Kota</label>
                                                  								<select class="form-select" aria-label="" id="new-kota" name="new-kota">
									                                             <?php echo $optionKota; ?>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-12 mb-3">
	                                                            				<label for="new-alamat" class="form-label">Alamat</label>
                                                  								<textarea class="form-control" aria-label="" id="new-alamat" name="new-alamat"></textarea>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-latitude" class="form-label">Latitude</label>
	                                                            				<input type="text" class="form-control" id="new-latitude" name="new-latitude">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-longitude" class="form-label">Longitude</label>
	                                                            				<input type="text" class="form-control" id="new-longitude" name="new-longitude">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-pengamat" class="form-label">Pengamat</label>
	                                                            				<input type="text" class="form-control" id="new-pengamat" name="new-pengamat">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="new-notelp" class="form-label">No. Telepon</label>
	                                                            				<input type="text" class="form-control" id="new-notelp" name="new-notelp">
	                                                            			</div>
	                                                            		</div>
	                                                            	</div>
	                                                            </div>
	                                                        </div>
	                                                        <div class="modal-footer">
	                                                            <button type="button" class="btn btn-secondary"
	                                                                data-bs-dismiss="modal">Close</button>
	                                                            <button type="button"
	                                                                class="btn btn-info">Save</button>
	                                                        </div>
	                                                    </div>
	                                                </div>
	                                            </div>
					                            <!-- Edit Modal -->
	                                            <div class="modal fade" id="editform" data-bs-backdrop="static"
	                                                data-bs-keyboard="false" tabindex="-1"
	                                                aria-labelledby="editformLabel" aria-hidden="true">
	                                                <div class="modal-dialog modal-lg">
	                                                    <div class="modal-content">
	                                                        <div class="modal-header">
	                                                            <h5 class="modal-title" id="editformLabel">Edit Lokasi POS</h5>
	                                                            <button type="button" class="btn-close"
	                                                                data-bs-dismiss="modal" aria-label="Close"></button>
	                                                        </div>
	                                                        <div class="modal-body">
	                                                            <div class="row">
	                                                            	<div class="col-6">
	                                                            		<div class="row">
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-kodepos" class="form-label">Kode POS</label>
                                                  								<input type="text" class="form-control" id="edit-kodepos" name="edit-kodepos">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-namaalat" class="form-label">Nama Alat</label>
                                                  								<input type="text" class="form-control" id="edit-namaalat" name="edit-namaalat">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-namapos" class="form-label">Nama POS</label>
                                                  								<input type="text" class="form-control" id="edit-namapos" name="edit-namapos" value="" disabled>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-tahunbangun" class="form-label">Tahun Bangun</label>
                                                  								<input type="text" class="form-control" id="edit-tahunbangun" name="edit-tahunbangun">
	                                                            			</div>
	                                                            			<!--div class="col-12 mb-3">
	                                                            				<label for="edit-namapos" class="form-label">Balai Besar Wilayah Sungai</label>
                                                  								<input type="text" class="form-control" id="edit-namapos" name="edit-namapos" value="Citanduy" disabled>
	                                                            			</div-->
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-tipepos" class="form-label">Tipe POS</label>
                                                  								<select class="form-select" aria-label="" id="edit-tipepos" name="edit-tipepos">
									                                                <option value="PCH">PCH</option>
									                                                <option value="PDA">PDA</option>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-merk" class="form-label">Merk</label>
                                                  								<select class="form-select" aria-label="" id="edit-merk" name="edit-merk">
									                                                <option value="APTECH">APTECH</option>
									                                                <option value="Campbell">Campbell</option>
									                                                <option value="FEWS">FEWS</option>
									                                                <option value="HIGERTECH">HIGERTECH</option>
									                                                <option value="ICU">ICU</option>
									                                                <option value="KOMTRONIK">KOMTRONIK</option>
									                                                <option value="MANUAL">MANUAL</option>
									                                                <option value="RADIO">RADIO</option>
									                                                <option value="SEBA">SEBA</option>
									                                                <option value="TATONAS">TATONAS</option>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="edit-siaga1" class="form-label">Siaga I</label>
                                                  								<input type="text" class="form-control" id="edit-siaga1" name="edit-siaga1">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="edit-siaga2" class="form-label">Siaga II</label>
                                                  								<input type="text" class="form-control" id="edit-siaga2" name="edit-siaga2">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="edit-siaga3" class="form-label">Siaga III</label>
                                                  								<input type="text" class="form-control" id="edit-siaga3" name="edit-siaga3">
	                                                            			</div>
	                                                            			<div class="col-3 mb-3">
	                                                            				<label for="edit-siaga4" class="form-label">Siaga IV</label>
                                                  								<input type="text" class="form-control" id="edit-siaga4" name="edit-siaga4">
	                                                            			</div>
	                                                            			<!--div class="col-3">
	                                                            				<label for="edit-kalibrasi" class="form-label">Kalibrasi</label>
                                                  								<input type="text" class="form-control" id="edit-kalibrasi" name="edit-kalibrasi">
	                                                            			</div-->
	                                                            			<div class="col-4">
	                                                            				<label for="edit-statuslok" class="form-label">Status</label>
                                                  								<select class="form-select" aria-label="" id="edit-statuslok" name="edit-statuslok">
                                                  									<option value="1">Active</option>
                                                  									<option value="0">Inactive</option>
                                                  								</select>
	                                                            			</div>
	                                                            			<div class="col-8 mb-3">
	                                                            				<label for="edit-fotolokasi" class="form-label">Foto Lokasi</label>
	                                                            				<input class="form-control" type="file" id="edit-fotolokasi" name="edit-fotolokasi">
	                                                            				
	                                                            			</div>
	                                                            		</div>
	                                                            	</div>
	                                                            	<div class="col-6">
	                                                            		<div class="row">
																			<div class="col-6 mb-3">
	                                                            				<label for="edit-provinsi" class="form-label">Provinsi</label>
                                                  								<select class="form-select" aria-label="" id="edit-provinsi" name="edit-provinsi">
                                                  								<?php echo $optionProvinsi; ?>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-kota" class="form-label">Kota</label>
                                                  								<select class="form-select" aria-label="" id="edit-kota" name="edit-kota">
									                                            <?php echo $optionKota; ?>
									                                            </select>
	                                                            			</div>
	                                                            			<div class="col-12 mb-3">
	                                                            				<label for="edit-alamat" class="form-label">Alamat</label>
                                                  								<textarea class="form-control" aria-label="" id="edit-alamat" name="edit-alamat"></textarea>
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-latitude" class="form-label">Latitude</label>
	                                                            				<input type="text" class="form-control" id="edit-latitude" name="edit-latitude">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-longitude" class="form-label">Longitude</label>
	                                                            				<input type="text" class="form-control" id="edit-longitude" name="edit-longitude">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-pengamat" class="form-label">Pengamat</label>
	                                                            				<input type="text" class="form-control" id="edit-pengamat" name="edit-pengamat">
	                                                            			</div>
	                                                            			<div class="col-6 mb-3">
	                                                            				<label for="edit-notelp" class="form-label">No. Telepon</label>
	                                                            				<input type="text" class="form-control" id="edit-notelp" name="edit-notelp">
	                                                            			</div>
	                                                            			<div class="col-12 mb-3">
	                                                            				<a href="" id="text-fotolokasi" target="_blank"></a>
	                                                            			</div>
	                                                            		</div>
	                                                            	</div>
	                                                            </div>
	                                                        </div>
	                                                        <div class="modal-footer">
	                                                            <button type="button" class="btn btn-secondary"
	                                                                data-bs-dismiss="modal">Close</button>
	                                                            <button type="button"
	                                                                class="btn btn-info">Save</button>
	                                                        </div>
	                                                    </div>
	                                                </div>
	                                            </div>
					                            <!-- Display Image Modal -->
	                                            <div class="modal fade" id="displayimage" data-bs-backdrop="static"
	                                                data-bs-keyboard="false" tabindex="-1"
	                                                aria-labelledby="displayimageLabel" aria-hidden="true">
	                                                <div class="modal-dialog modal-lg">
	                                                    <div class="modal-content">
	                                                        <div class="modal-header">
	                                                            <h5 class="modal-title" id="displayimageLabel">Foto Lokasi </h5>
	                                                            <button type="button" class="btn-close"
	                                                                data-bs-dismiss="modal" aria-label="Close"></button>
	                                                        </div>
	                                                        <div class="modal-body">
	                                                            <div class="row">
	                                                            	<div class="col-12">
	                                                            		<img src="http://sdatelemetry.com/gambarpos/salawe.jpg" id="display-img" style="width: 100%;">
	                                                            	</div>
	                                                            </div>
	                                                        </div>
	                                                    </div>
	                                                </div>
	                                            </div>
                                            </div>
                                        </div>
                                    </div>
                                    

                                </div>
                            </div>
                        </div>
                    </div>        