fix komuditi pukal
This commit is contained in:
@@ -3,10 +3,13 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class KomuditiController extends Controller
|
class KomuditiController extends Controller
|
||||||
{
|
{
|
||||||
public function index(){
|
public function index(){
|
||||||
return view('operasi.komuditi.index');
|
$auth_user = Auth::user();
|
||||||
|
$user_name = $auth_user['name'];
|
||||||
|
return view('operasi.komuditi.index',compact('user_name'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row form-group justify-content-center">
|
<div class="row form-group justify-content-center">
|
||||||
|
<input type="hidden" value="{{ $user_name }}" id="user_name" name="user_name">
|
||||||
<button class="btn btn-primary" id="pendahuluan">Pendahuluan Komuditi</button>
|
<button class="btn btn-primary" id="pendahuluan">Pendahuluan Komuditi</button>
|
||||||
<button class="btn btn-primary ml-md-2" id="tambah">Tambah Komuditi</button>
|
<button class="btn btn-primary ml-md-2" id="tambah">Tambah Komuditi</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -86,6 +87,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#pendahuluan').click(async function(){
|
$('#pendahuluan').click(async function(){
|
||||||
|
var user_name = $('#user_name').val();
|
||||||
const { value: komuditi } = await Swal.fire({
|
const { value: komuditi } = await Swal.fire({
|
||||||
title: 'Pembelian Komuditi',
|
title: 'Pembelian Komuditi',
|
||||||
input: 'text',
|
input: 'text',
|
||||||
@@ -107,7 +109,7 @@
|
|||||||
url:'http://api_arrahn.test/api/komuditi/pendahuluan',
|
url:'http://api_arrahn.test/api/komuditi/pendahuluan',
|
||||||
data:{
|
data:{
|
||||||
'unit_komuditi':komuditi,
|
'unit_komuditi':komuditi,
|
||||||
'purchased_by':'afiq'
|
'purchased_by': user_name
|
||||||
},
|
},
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
success:function(){
|
success:function(){
|
||||||
@@ -131,6 +133,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
$('#tambah').click(async function(){
|
$('#tambah').click(async function(){
|
||||||
|
var user_name = $('#user_name').val();
|
||||||
const { value: komuditi } = await Swal.fire({
|
const { value: komuditi } = await Swal.fire({
|
||||||
title: 'Pembelian Komuditi',
|
title: 'Pembelian Komuditi',
|
||||||
input: 'text',
|
input: 'text',
|
||||||
@@ -141,7 +144,7 @@
|
|||||||
cancelButtonText: 'Batal',
|
cancelButtonText: 'Batal',
|
||||||
inputValidator: (value) => {
|
inputValidator: (value) => {
|
||||||
if($.isNumeric(value) == false){
|
if($.isNumeric(value) == false){
|
||||||
return 'Sila Unit Komuditi Yang Dibeli'
|
return 'Sila Masukkan Unit Komuditi Yang Dibeli'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -152,7 +155,7 @@
|
|||||||
url:'http://api_arrahn.test/api/komuditi/update',
|
url:'http://api_arrahn.test/api/komuditi/update',
|
||||||
data:{
|
data:{
|
||||||
'unit_komuditi':komuditi,
|
'unit_komuditi':komuditi,
|
||||||
'purchased_by':'afiq'
|
'purchased_by': user_name
|
||||||
},
|
},
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
success:function(){
|
success:function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user