update code 21/08/2022
This commit is contained in:
parent
5dc4551b7c
commit
3a88fe8317
|
@ -54,6 +54,32 @@ public static function get_stok_barang($id_barang,$jenis_barang = '')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_join_barang($id_barang,$table = '')
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = DB::table('tbl_barang')
|
||||||
|
->where('id',$id_barang)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$data_join = DB::table('tbl_barang')
|
||||||
|
->join('tbl_satuan','tbl_satuan.id','=','tbl_barang.satuan_id')
|
||||||
|
->join('tbl_jenis_barang','tbl_jenis_barang.id','=','tbl_barang.jenis_barang_id')
|
||||||
|
->join('tbl_kategori_simak','tbl_jenis_barang.id','=','tbl_barang.kategori_simak_id')
|
||||||
|
->where('id',$id_barang)
|
||||||
|
->get();
|
||||||
|
if($table == 'jenis'){
|
||||||
|
|
||||||
|
return $data_join[0]->nama_jenis;
|
||||||
|
}else if($table == 'kategori_simak'){
|
||||||
|
|
||||||
|
return $data_join[0]->nama_kategori;
|
||||||
|
}else if($table == 'satuan'){
|
||||||
|
return $data_join[0]->nama_satuan;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static function get_image_barang($id_barang){
|
public static function get_image_barang($id_barang){
|
||||||
|
|
||||||
$data = DB::table('tbl_barang')
|
$data = DB::table('tbl_barang')
|
||||||
|
|
|
@ -88,19 +88,19 @@ public function updates_barang(Request $request)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!$request->validate([
|
if(!empty($request->file('image_barang'))){
|
||||||
'image_barang' => 'required|mimes:png,jpg,jpeg|max:2048',
|
|
||||||
])){
|
|
||||||
return redirect('barang')->with('error', 'Pastikan File Berekstensi PNG,JPG,JPEG ..');
|
|
||||||
|
|
||||||
}
|
if(!$request->validate([
|
||||||
|
'image_barang' => 'mimes:png,jpg,jpeg|max:2048',
|
||||||
|
])){
|
||||||
|
return redirect('barang')->with('error', 'Pastikan File Berekstensi PNG,JPG,JPEG ..');
|
||||||
|
|
||||||
$file = $request->file('image_barang');
|
}
|
||||||
|
|
||||||
$fileName = 'barang-'.time().'.'.$file->extension();
|
$file = $request->file('image_barang');
|
||||||
|
|
||||||
if($file->move(public_path('upload_image'), $fileName)){
|
|
||||||
|
|
||||||
|
$fileName = 'barang-'.time().'.'.$file->extension();
|
||||||
|
$file->move(public_path('upload_image'), $fileName);
|
||||||
$data_update = array(
|
$data_update = array(
|
||||||
'jenis_barang_id'=>$request->jenis_barang,
|
'jenis_barang_id'=>$request->jenis_barang,
|
||||||
'satuan_id'=>$request->satuan_barang,
|
'satuan_id'=>$request->satuan_barang,
|
||||||
|
@ -128,8 +128,30 @@ public function updates_barang(Request $request)
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
$data_update = array(
|
||||||
|
'jenis_barang_id'=>$request->jenis_barang,
|
||||||
|
'satuan_id'=>$request->satuan_barang,
|
||||||
|
'jumlah_barang'=>$request->jumlah,
|
||||||
|
'lokasi'=>$request->lokasi,
|
||||||
|
'tanggal_masuk'=>$request->tanggal_masuk,
|
||||||
|
'keterangan'=>$request->keterangan,
|
||||||
|
'kode_barang'=>$request->kode_barang,
|
||||||
|
'kategori_simak_id'=>$request->kategori_simak,
|
||||||
|
'harga'=>$request->harga_barang,
|
||||||
|
'nup'=>$request->nup,
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
$update = DB::table('tbl_barang')->where('id',$id_barang)->update($data_update);
|
||||||
|
if($update){
|
||||||
|
|
||||||
|
return redirect('barang')->with('sukses', 'Data Barang Berhasil di Update ..');
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return redirect('barang')->with('error', 'Data Barang Gagal di Update ..');
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('barang')->with('error', 'Data File Gagal di Upload ..');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
use App\Models\SatuanBarang;
|
use App\Models\SatuanBarang;
|
||||||
use App\Models\Pengguna;
|
use App\Models\Pengguna;
|
||||||
use App\Models\Transaksi;
|
use App\Models\Transaksi;
|
||||||
|
use App\Models\KategoriSimak;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
class TransaksiController extends Controller
|
class TransaksiController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,7 @@ public function index()
|
||||||
|
|
||||||
$data['satuan_barang'] = SatuanBarang::all();
|
$data['satuan_barang'] = SatuanBarang::all();
|
||||||
$data['jenis_barang'] = jenisBarang::all();
|
$data['jenis_barang'] = jenisBarang::all();
|
||||||
|
$data['kategori_simak'] = KategoriSimak::all();
|
||||||
return view('admin.transaksi.index',$data);
|
return view('admin.transaksi.index',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,9 @@
|
||||||
<td><span class="fas fa-calendar-check"></span> {{ $i->tanggal_masuk }}</td>
|
<td><span class="fas fa-calendar-check"></span> {{ $i->tanggal_masuk }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
|
||||||
<a data-id="{{ $i->id }}" href="#" data-toggle="tooltip" data-placement="top" title="Edit" class=" modal_edit text-right btn btn-md btn-outline-success"><i class="fas fa-edit text-right"></i> </a>
|
<a data-id="{{ $i->id }}" href="#" data-toggle="tooltip" data-placement="top" title="Edit" class=" modal_edit text-right btn btn-sm btn-outline-success"><i class="fas fa-edit text-right"></i> </a>
|
||||||
<a data-toggle="tooltip" data-placement="top" title="Hapus" onclick="return confirm('barang ini akan di delete ... ?')" href="{{ route('barang.hapus',$i->id) }}" class=" text-right btn btn-md btn-outline-danger"><i class="fas fa-trash"></i> </a>
|
<a data-toggle="tooltip" data-placement="top" title="Hapus" onclick="return confirm('barang ini akan di delete ... ?')" href="{{ route('barang.hapus',$i->id) }}" class=" text-right btn btn-sm btn-outline-danger"><i class="fas fa-trash"></i> </a>
|
||||||
<a data-id="{{ $i->id }}" href="#" data-toggle="tooltip" data-placement="top" title="Barang Keluar" class=" modal_keluar text-right btn btn-md btn-outline-primary"><i class="fas fa-arrow-right text-right"></i> </a>
|
<a data-id="{{ $i->id }}" href="#" data-toggle="tooltip" data-placement="top" title="Barang Keluar" class=" modal_keluar text-right btn btn-sm btn-outline-primary"><i class="fas fa-arrow-right text-right"></i> </a>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -302,6 +302,9 @@
|
||||||
$("[name=keterangan]").val(obj[0].keterangan);
|
$("[name=keterangan]").val(obj[0].keterangan);
|
||||||
$("[name=jumlah]").val(obj[0].jumlah_barang);
|
$("[name=jumlah]").val(obj[0].jumlah_barang);
|
||||||
$("[name=tanggal_masuk]").val(obj[0].tanggal_masuk);
|
$("[name=tanggal_masuk]").val(obj[0].tanggal_masuk);
|
||||||
|
$("[name=kategori_simak]").val(obj[0].kategori_simak_id);
|
||||||
|
$("[name=satuan_barang]").val(obj[0].satuan_id);
|
||||||
|
$("[name=jenis_barang]").val(obj[0].jenis_barang_id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,23 @@
|
||||||
<input class="form-control" required placeholder="inputkan Serial Number ..." type="text" name="serial_number">
|
<input class="form-control" required placeholder="inputkan Serial Number ..." type="text" name="serial_number">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group mb-3 col-6">
|
||||||
|
<div class="input-group input-group-alternative">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" required placeholder="inputkan Kode Barang ..." type="text" name="kode_barang">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-3 col-6">
|
||||||
|
<div class="input-group input-group-alternative">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" required placeholder="inputkan NUP Barang..." type="text" name="nup">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -87,6 +104,29 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-3 col-6">
|
||||||
|
<div class="input-group input-group-alternative">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"> <i class="fas fa-list"></i></span>
|
||||||
|
</div>
|
||||||
|
<select name="kategori_simak" class="form-control" required>
|
||||||
|
<option value="">-- Pilih Kategori Simak --</option>
|
||||||
|
@foreach($kategori_simak as $i)
|
||||||
|
<option value="{{ $i->id }}" <?php if($i->id) ?>>{{ $i->nama_kategori }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-3 col-6">
|
||||||
|
<div class="input-group input-group-alternative">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fas fa-money-check"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="form-control" required placeholder="Update Harga Barang ..." type="number" name="harga">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-3">
|
<div class="form-group mb-3">
|
||||||
<div class="input-group input-group-alternative">
|
<div class="input-group input-group-alternative">
|
||||||
|
@ -110,7 +150,7 @@
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fas fa-upload"></i></span>
|
<span class="input-group-text"><i class="fas fa-upload"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<input class="custom-file-input form-control" required placeholder="inputkan Jumlah Barang ..." type="file" name="image_barang"><br>
|
<input class="custom-file-input form-control" placeholder="inputkan Jumlah Barang ..." type="file" name="image_barang"><br>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user