partial update create toggle active product and mutations
This commit is contained in:
@@ -13,6 +13,7 @@ let table = $("#products-table").DataTable({
|
||||
{ data: "code", name: "code" },
|
||||
{ data: "name", name: "name" },
|
||||
{ data: "category_name", name: "category.name" },
|
||||
{ data: "unit", name: "unit" },
|
||||
{ data: "total_stock", name: "total_stock" },
|
||||
{ data: "action", name: "action", orderable: false, searchable: false },
|
||||
],
|
||||
@@ -48,3 +49,37 @@ $(document).on("click", ".btn-destroy-product", function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on("click", ".btn-toggle-active", function () {
|
||||
let button = $(this);
|
||||
let url = button.data("url");
|
||||
|
||||
Swal.fire({
|
||||
title: "Status produk?",
|
||||
text: "Anda yakin ingin mengganti status produk!",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#dedede",
|
||||
confirmButtonText: "Ya",
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: "POST",
|
||||
data: {
|
||||
_token: $('meta[name="csrf-token"]').attr("content"),
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
$("#products-table")
|
||||
.DataTable()
|
||||
.ajax.reload(null, false);
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("Gagal mengubah status produk.");
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
<input type="text" name="name" id="name" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="unit"><strong>Satuan Produk</strong></label>
|
||||
<input type="text" name="unit" id="unit" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description"><strong>Deskripsi</strong></label>
|
||||
<textarea name="description" id="description" class="form-control" rows="3"></textarea>
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
<input type="text" name="name" id="name" class="form-control" value="{{ old('name', $product->name) }}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="unit"><strong>Satuan Produk</strong></label>
|
||||
<input type="text" name="unit" id="unit" class="form-control" value="{{ old('unit', $product->unit) }}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description"><strong>Deskripsi</strong></label>
|
||||
<textarea name="description" id="description" class="form-control" rows="3">{{ old('description', $product->description) }}</textarea>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<th>Kode</th>
|
||||
<th>Nama</th>
|
||||
<th>Kategori</th>
|
||||
<th>Satuan</th>
|
||||
<th>Stok</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
@extends('layouts.backapp')
|
||||
|
||||
@section('content')
|
||||
<div class="kt-portlet kt-portlet--mobile" id="kt_blockui_datatable">
|
||||
<div class="kt-portlet__head kt-portlet__head--lg">
|
||||
<div class="kt-portlet__head-label">
|
||||
<span class="kt-portlet__head-icon">
|
||||
<i class="kt-font-brand flaticon2-line-chart"></i>
|
||||
</span>
|
||||
<h3 class="kt-portlet__head-title">
|
||||
Tabel Mutasi Stock Produk
|
||||
</h3>
|
||||
</div>
|
||||
{{-- @can('create', $menus['mutations.index'])
|
||||
<div class="kt-portlet__head-toolbar">
|
||||
<div class="kt-portlet__head-wrapper">
|
||||
<div class="kt-portlet__head-actions">
|
||||
<a href="{{ route('products.create') }}" class="btn btn-bold btn-label-brand btn--sm">Tambah</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endcan --}}
|
||||
</div>
|
||||
|
||||
<div class="kt-portlet__body">
|
||||
<div class="table-responsive">
|
||||
<!--begin: Datatable -->
|
||||
<table class="table table-striped table-bordered table-hover" id="mutations-table" data-url="{{ route("mutations.index") }}">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Produk</th>
|
||||
<th>Dealer</th>
|
||||
<th>User</th>
|
||||
<th>Tipe Mutasi</th>
|
||||
<th>Dibuat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<!--end: Datatable -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script src="{{mix('js/warehouse_management/stock_mutations/index.js')}}"></script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user