164 lines
5.5 KiB
PHP
164 lines
5.5 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-11 mx-auto card p-4">
|
|
@if ($message = Session::get('success'))
|
|
<div class="alert alert-success">
|
|
<p>{{ $message }}</p>
|
|
</div>
|
|
@endif
|
|
<h3 class="pt-3" style="margin-left:2%;">Import Data Cawangan</h3>
|
|
<form id="exportform" action="" method="POST">
|
|
<?php
|
|
echo " <table class='table table-striped' id='cawangan'>";
|
|
echo " <thead>";
|
|
echo " <tr>";
|
|
echo " <th>#</th>";
|
|
echo " <th>Cawangan</th>";
|
|
//echo " <th>Tarikh Lelong</th>";
|
|
//echo " <th>Batch Lelong</th>";
|
|
//echo " <th>Tarikh Lelong</th>";
|
|
echo " <th>Import Data</th>";
|
|
echo " <th>Hapus Data</th>";
|
|
// echo " <th>Senarai Lelongan</th>";
|
|
// echo " <th>Export Data</th>";
|
|
echo " </tr>";
|
|
echo " </thead>";
|
|
echo "<tbody>";
|
|
|
|
$count = 0;
|
|
// $result = mysql_query("SELECT * FROM cawangan_lelong");
|
|
$results = DB::select('select * from cawangan');
|
|
foreach($results as $row)
|
|
{
|
|
$caw_ip = $row->caw_ip;
|
|
$caw_dbuser = $row->caw_dbuser;
|
|
$caw_dbpass = $row->caw_dbpass;
|
|
$caw_dbname = $row->caw_dbname;
|
|
$caw_name = $row->caw_name;
|
|
$caw_id = $row->id;
|
|
$kodcaw = $row->caw_code;
|
|
|
|
//dd($caw_ip);
|
|
|
|
$db = mysqli_connect($caw_ip,$caw_dbuser, $caw_dbpass);
|
|
if (!$db)
|
|
{
|
|
echo "<p style='color:#F00'>Server Down: $con[caw_dbname]/$con[caw_name]</p>";
|
|
continue;
|
|
die('Could not connect: ' . mysqli_error());
|
|
}
|
|
mysqli_select_db($db,$caw_dbname);
|
|
$count++;
|
|
|
|
|
|
echo "<tr>";
|
|
echo "<td>$count</td>";
|
|
echo "<td>$caw_name</td>";
|
|
//echo "<td>$tarikh</td>";
|
|
// echo "<td>$batchno</td>";
|
|
//echo "<td>$tarikh</td>";
|
|
echo "<td><a class='btn btn-info' href='importdatagadai/$kodcaw'><i class='fa fa-delete'></i>Import Data From Live To Master</a></td>";
|
|
echo "<td><a class='btn btn-danger' href='hapusdatacawangan/$kodcaw'><i class='fa fa-delete'></i>Hapus</a></td>";
|
|
// echo "<td><a class='btn btn-success' href='list_gadai_caw/$caw_id'><i class='fa fa-delete'></i>Lihat Senarai</a></td>";
|
|
// echo "<td><a class='btn btn-warning' href='exportdatalelong/$caw_id'><i class='fa fa-success'></i>Export Data</a></td>";
|
|
echo "</tr>";
|
|
|
|
}
|
|
echo "</table>"?>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<script>
|
|
//Enable tooltips everywhere
|
|
$(function () {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
})
|
|
function newconnection() {
|
|
$("#formnewconnection").submit();
|
|
}
|
|
function confirm(id) {
|
|
// console.log(id);
|
|
$.confirm({
|
|
title: 'Confirmation',
|
|
content: 'Anda pasti?',
|
|
type: 'orange',
|
|
typeAnimated: true,
|
|
buttons: {
|
|
Delete: {
|
|
btnClass: 'btn-warning',
|
|
action: function () {
|
|
$("#formdelconn-"+id).submit();
|
|
}
|
|
},
|
|
Batal: {
|
|
btnClass: 'btn-default',
|
|
action: function () {}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
var tablecawangan = $('#cawangan').DataTable({
|
|
"columnDefs": [
|
|
{
|
|
"targets": 0,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"targets": 8,
|
|
"orderable": false
|
|
}
|
|
],
|
|
order: [[1, 'asc']],
|
|
"info": false,
|
|
"lengthChange": false,
|
|
"pageLength": 15,
|
|
dom: 'Bfrtip',
|
|
buttons: [
|
|
{
|
|
className: 'btn btn-outline-success pl-4 pr-4 btn-sm addcaw',
|
|
text: '<i class="fas fa-plus" id="test"></i>',
|
|
titleAttr: 'Tambah Cawangan',
|
|
action: function ( e, dt, node, config ) {
|
|
// alert( 'Button activated' );
|
|
// console.log('hye');
|
|
|
|
$('#myModal').modal("show");
|
|
$('#myModal').on('shown.bs.modal', function () {
|
|
$('#rolename').trigger('focus')
|
|
})
|
|
}
|
|
},
|
|
{
|
|
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
|
|
titleAttr: 'Export to CSV',
|
|
text: '<i class="fas fa-download"></i>',
|
|
action: function ( e, dt, node, config ) {
|
|
$("#exportform").submit();
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
$('.addcaw').tooltip();
|
|
$('.export').tooltip();
|
|
// $( '.dt-buttons').addClass('btn-group');
|
|
$( '.addcaw').removeClass('dt-button');
|
|
$( '.export').removeClass('dt-button');
|
|
|
|
|
|
function selectall(cb) {
|
|
tablecawangan.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
|
|
$(this).prop('checked', cb.checked);
|
|
})
|
|
}
|
|
</script>
|
|
|
|
@endsection
|