Muhammad Iqbal Afandi пре 4 година
родитељ
комит
84cd7e0b01
41 измењених фајлова са 3318 додато и 179 уклоњено
  1. 3
    2
      app/Http/Controllers/CustomerController.php
  2. 4
    2
      app/Http/Controllers/ProductController.php
  3. 47
    11
      app/Http/Controllers/SalesController.php
  4. 11
    8
      app/Http/Controllers/SupplierController.php
  5. 1
    1
      app/Http/Requests/Sales/StoreSaleRequest.php
  6. 32
    0
      app/Http/Requests/Sales/UpdateSaleRequest.php
  7. 5
    0
      app/Models/Customer.php
  8. 1
    1
      app/Models/Price.php
  9. 18
    0
      app/Models/Product.php
  10. 2
    2
      app/Models/PurchaseDetail.php
  11. 9
    4
      app/Models/Sale.php
  12. 11
    2
      app/Models/SaleDetail.php
  13. 1
    1
      app/Models/StockProduct.php
  14. 5
    0
      app/Models/Supplier.php
  15. 15
    0
      app/Services/ProductService.php
  16. 1
    1
      database/migrations/2022_06_16_091443_create_sales_table.php
  17. 2
    1
      database/migrations/2022_06_17_115154_create_sale_details_table.php
  18. 8
    4
      lang/en/messages.php
  19. 8
    4
      lang/id/messages.php
  20. 9
    43
      public/js/resources_js_pages_Customers_Edit_vue.js
  21. 62
    12
      public/js/resources_js_pages_Customers_Index_vue.js
  22. 35
    5
      public/js/resources_js_pages_Products_Create_vue.js
  23. 35
    5
      public/js/resources_js_pages_Products_Edit_vue.js
  24. 63
    13
      public/js/resources_js_pages_Products_Index_vue.js
  25. 3
    3
      public/js/resources_js_pages_Sales_Create_vue.js
  26. 2637
    0
      public/js/resources_js_pages_Sales_Edit_vue.js
  27. 12
    2
      public/js/resources_js_pages_Sales_Index_vue.js
  28. 1
    1
      public/js/resources_js_pages_Sales_config_js.js
  29. 62
    12
      public/js/resources_js_pages_Suppliers_Index_vue.js
  30. 9
    1
      public/js/vue.js
  31. 1
    0
      resources/js/components/AppDropdown.vue
  32. 1
    33
      resources/js/pages/Customers/Edit.vue
  33. 33
    0
      resources/js/pages/Customers/Index.vue
  34. 2
    0
      resources/js/pages/Products/Create.vue
  35. 1
    0
      resources/js/pages/Products/Edit.vue
  36. 34
    1
      resources/js/pages/Products/Index.vue
  37. 2
    2
      resources/js/pages/Sales/Create.vue
  38. 90
    0
      resources/js/pages/Sales/Edit.vue
  39. 8
    1
      resources/js/pages/Sales/Index.vue
  40. 1
    1
      resources/js/pages/Sales/config.js
  41. 33
    0
      resources/js/pages/Suppliers/Index.vue

+ 3
- 2
app/Http/Controllers/CustomerController.php Прегледај датотеку

@@ -31,7 +31,8 @@ class CustomerController extends Controller
31 31
                     'name' => $customer->name,
32 32
                     'address' => $customer->address,
33 33
                     'phone' => $customer->phone,
34
-                    'npwp' => $customer->npwp
34
+                    'npwp' => $customer->npwp,
35
+                    'isUsed' => $customer->sales()->exists()
35 36
                 ])
36 37
         ]);
37 38
     }
@@ -105,6 +106,6 @@ class CustomerController extends Controller
105 106
     {
106 107
         $customer->delete();
107 108
 
108
-        return to_route('customers.index')->with('success', __('messages.success.destroy.customer'));
109
+        return back()->with('success', __('messages.success.destroy.customer'));
109 110
     }
110 111
 }

+ 4
- 2
app/Http/Controllers/ProductController.php Прегледај датотеку

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
5 5
 use App\Http\Requests\Product\StoreProductRequest;
6 6
 use App\Http\Requests\Product\UpdateProductRequest;
7 7
 use App\Models\Product;
8
+use App\Services\ProductService;
8 9
 use Inertia\Inertia;
9 10
 
10 11
 class ProductController extends Controller
@@ -26,7 +27,8 @@ class ProductController extends Controller
26 27
                     'id' => $product->id,
27 28
                     'number' => $product->number,
28 29
                     'name' => $product->name,
29
-                    'unit' => $product->unit
30
+                    'unit' => $product->unit,
31
+                    'isUsed' => ProductService::isUsed($product)
30 32
                 ])
31 33
         ]);
32 34
     }
@@ -102,6 +104,6 @@ class ProductController extends Controller
102 104
     {
103 105
         $product->delete();
104 106
 
105
-        return to_route('products.index')->with('success', __('messages.success.destroy.product'));
107
+        return back()->with('success', __('messages.success.destroy.product'));
106 108
     }
107 109
 }

+ 47
- 11
app/Http/Controllers/SalesController.php Прегледај датотеку

@@ -3,10 +3,12 @@
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\Http\Requests\Sales\StoreSaleRequest;
6
+use App\Http\Requests\Sales\UpdateSaleRequest;
6 7
 use App\Models\Customer;
7 8
 use App\Models\Product;
8 9
 use App\Models\Sale;
9
-use Illuminate\Http\Request;
10
+use Illuminate\Database\QueryException;
11
+use Illuminate\Support\Facades\DB;
10 12
 use Inertia\Inertia;
11 13
 
12 14
 class SalesController extends Controller
@@ -85,16 +87,26 @@ class SalesController extends Controller
85 87
      */
86 88
     public function store(StoreSaleRequest $request)
87 89
     {
88
-        $validated = $request->safe()->merge([
89
-            'user_id' => auth()->user()->id,
90
-            'ppn' => 11
91
-        ])->all();
90
+        DB::beginTransaction();
92 91
 
93
-        $sale = Sale::create($validated);
92
+        try {
93
+            $validated = $request->safe()->merge([
94
+                'user_id' => auth()->user()->id,
95
+                'ppn' => 11
96
+            ])->all();
94 97
 
95
-        $sale->saleDetail()->create($validated);
98
+            $sale = Sale::create($validated);
96 99
 
97
-        return back()->with('success', __('messages.success.store.sale'));
100
+            $sale->saleDetail()->create($validated);
101
+
102
+            DB::commit();
103
+
104
+            return back()->with('success', __('messages.success.store.sale'));
105
+        } catch (QueryException $e) {
106
+            DB::rollBack();
107
+
108
+            return back()->with('error', __('messages.error.store.sale'));
109
+        }
98 110
     }
99 111
 
100 112
     /**
@@ -116,7 +128,19 @@ class SalesController extends Controller
116 128
      */
117 129
     public function edit(Sale $sale)
118 130
     {
119
-        //
131
+        return inertia('Sales/Edit', [
132
+            'sale' => [
133
+                'id' => $sale->id,
134
+                'number' => $sale->number,
135
+                'status' => [
136
+                    'value' => $sale->status
137
+                ],
138
+                'price' => $sale->saleDetail->getRawOriginal('price'),
139
+                'qty' => $sale->saleDetail->qty,
140
+                'customer' => $sale->customer,
141
+                'product' => $sale->product
142
+            ]
143
+        ]);
120 144
     }
121 145
 
122 146
     /**
@@ -126,9 +150,21 @@ class SalesController extends Controller
126 150
      * @param  Sale $sale
127 151
      * @return \Illuminate\Http\Response
128 152
      */
129
-    public function update(Request $request, Sale $sale)
153
+    public function update(UpdateSaleRequest $request, Sale $sale)
130 154
     {
131
-        //
155
+        dd($request->validated());
156
+
157
+        DB::beginTransaction();
158
+
159
+        try {
160
+            DB::commit();
161
+
162
+            return back()->with('succes', __('messages.success.update.sale'));
163
+        } catch (QueryException $e) {
164
+            DB::rollBack();
165
+
166
+            return back()->with('error', __('messages.error.update.sale'));
167
+        }
132 168
     }
133 169
 
134 170
     /**

+ 11
- 8
app/Http/Controllers/SupplierController.php Прегледај датотеку

@@ -26,13 +26,14 @@ class SupplierController extends Controller
26 26
                 ->latest()
27 27
                 ->paginate(10)
28 28
                 ->withQueryString()
29
-                ->through(fn($customer) => [
30
-                    'id' => $customer->id,
31
-                    'name' => $customer->name,
32
-                    'address' => $customer->address,
33
-                    'email' => $customer->email,
34
-                    'phone' => $customer->phone,
35
-                    'npwp' => $customer->npwp
29
+                ->through(fn($supplier) => [
30
+                    'id' => $supplier->id,
31
+                    'name' => $supplier->name,
32
+                    'address' => $supplier->address,
33
+                    'email' => $supplier->email,
34
+                    'phone' => $supplier->phone,
35
+                    'npwp' => $supplier->npwp,
36
+                    'isUsed' => $supplier->purchases()->exists()
36 37
                 ])
37 38
         ]);
38 39
     }
@@ -104,6 +105,8 @@ class SupplierController extends Controller
104 105
      */
105 106
     public function destroy(Supplier $supplier)
106 107
     {
107
-        //
108
+        $supplier->delete();
109
+
110
+        return back()->with('success', __('messages.success.destroy.supplier'));
108 111
     }
109 112
 }

+ 1
- 1
app/Http/Requests/Sales/StoreSaleRequest.php Прегледај датотеку

@@ -29,7 +29,7 @@ class StoreSaleRequest extends FormRequest
29 29
             'price' => 'required|numeric',
30 30
             'qty' => 'required|numeric',
31 31
             'customer_id' => 'required|numeric',
32
-            'product_id' => 'required|string'
32
+            'product_number' => 'required|string'
33 33
         ];
34 34
     }
35 35
 }

+ 32
- 0
app/Http/Requests/Sales/UpdateSaleRequest.php Прегледај датотеку

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+namespace App\Http\Requests\Sales;
4
+
5
+use Illuminate\Foundation\Http\FormRequest;
6
+
7
+class UpdateSaleRequest extends FormRequest
8
+{
9
+    /**
10
+     * Determine if the user is authorized to make this request.
11
+     *
12
+     * @return bool
13
+     */
14
+    public function authorize()
15
+    {
16
+        return true;
17
+    }
18
+
19
+    /**
20
+     * Get the validation rules that apply to the request.
21
+     *
22
+     * @return array<string, mixed>
23
+     */
24
+    public function rules()
25
+    {
26
+        return [
27
+            'status' => 'required|string',
28
+            'price' => 'required|numeric',
29
+            'qty' => 'required|numeric'
30
+        ];
31
+    }
32
+}

+ 5
- 0
app/Models/Customer.php Прегледај датотеку

@@ -18,6 +18,11 @@ class Customer extends Model
18 18
 
19 19
     protected $hidden = ['created_at', 'updated_at'];
20 20
 
21
+    public function sales()
22
+    {
23
+        return $this->hasMany(Sale::class);
24
+    }
25
+
21 26
     public function scopeFilter($query, array $filters)
22 27
     {
23 28
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 1
- 1
app/Models/Price.php Прегледај датотеку

@@ -11,7 +11,7 @@ class Price extends Model
11 11
 
12 12
     protected $fillable = [
13 13
         'price',
14
-        'product_id',
14
+        'product_number',
15 15
         'customer_id',
16 16
         'supplier_id'
17 17
     ];

+ 18
- 0
app/Models/Product.php Прегледај датотеку

@@ -2,6 +2,9 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
+use App\Models\PurchaseDetail;
6
+use App\Models\SaleDetail;
7
+use App\Models\StockProduct;
5 8
 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 9
 use Illuminate\Database\Eloquent\Model;
7 10
 
@@ -17,6 +20,21 @@ class Product extends Model
17 20
 
18 21
     protected $hidden = ['created_at', 'updated_at'];
19 22
 
23
+    public function stockProducts()
24
+    {
25
+        return $this->hasMany(StockProduct::class, 'product_number', 'number');
26
+    }
27
+
28
+    public function purchaseDetails()
29
+    {
30
+        return $this->hasMany(PurchaseDetail::class, 'product_number', 'number');
31
+    }
32
+
33
+    public function saleDetails()
34
+    {
35
+        return $this->hasMany(SaleDetail::class, 'product_number', 'number');
36
+    }
37
+
20 38
     public function scopeFilter($query, array $filters)
21 39
     {
22 40
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 2
- 2
app/Models/PurchaseDetail.php Прегледај датотеку

@@ -13,7 +13,7 @@ class PurchaseDetail extends Model
13 13
         'price',
14 14
         'ppn',
15 15
         'qty',
16
-        'purchase_id',
17
-        'product_id'
16
+        'purchase_number',
17
+        'product_number'
18 18
     ];
19 19
 }

+ 9
- 4
app/Models/Sale.php Прегледај датотеку

@@ -27,7 +27,7 @@ class Sale extends Model
27 27
 
28 28
     public function saleDetail()
29 29
     {
30
-        return $this->hasOne(SaleDetail::class);
30
+        return $this->hasOne(SaleDetail::class, 'sale_number', 'number');
31 31
     }
32 32
 
33 33
     public function product()
@@ -35,13 +35,18 @@ class Sale extends Model
35 35
         return $this->hasOneThrough(
36 36
             Product::class,
37 37
             SaleDetail::class,
38
-            'sale_id',
38
+            'sale_number',
39 39
             'number',
40
-            'id',
41
-            'product_id'
40
+            'number',
41
+            'product_number'
42 42
         );
43 43
     }
44 44
 
45
+    public function customer()
46
+    {
47
+        return $this->belongsTo(Customer::class);
48
+    }
49
+
45 50
     public function scopeFilter($query, array $filters)
46 51
     {
47 52
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 11
- 2
app/Models/SaleDetail.php Прегледај датотеку

@@ -2,6 +2,8 @@
2 2
 
3 3
 namespace App\Models;
4 4
 
5
+use App\Services\HelperService;
6
+use Illuminate\Database\Eloquent\Casts\Attribute;
5 7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 8
 use Illuminate\Database\Eloquent\Model;
7 9
 
@@ -13,7 +15,14 @@ class SaleDetail extends Model
13 15
         'price',
14 16
         'ppn',
15 17
         'qty',
16
-        'sale_id',
17
-        'product_id'
18
+        'sale_number',
19
+        'product_number'
18 20
     ];
21
+
22
+    public function price(): Attribute
23
+    {
24
+        return Attribute::make(
25
+            get:fn($value) => HelperService::setRupiahFormat($value, true)
26
+        );
27
+    }
19 28
 }

+ 1
- 1
app/Models/StockProduct.php Прегледај датотеку

@@ -13,6 +13,6 @@ class StockProduct extends Model
13 13
         'purchase_number',
14 14
         'sale_number',
15 15
         'amount',
16
-        'product_id'
16
+        'product_number'
17 17
     ];
18 18
 }

+ 5
- 0
app/Models/Supplier.php Прегледај датотеку

@@ -19,6 +19,11 @@ class Supplier extends Model
19 19
 
20 20
     protected $hidden = ['created_at', 'updated_at'];
21 21
 
22
+    public function purchases()
23
+    {
24
+        return $this->hasMany(Purchase::class);
25
+    }
26
+
22 27
     public function scopeFilter($query, array $filters)
23 28
     {
24 29
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 15
- 0
app/Services/ProductService.php Прегледај датотеку

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+namespace App\Services;
4
+
5
+use App\Models\Product;
6
+
7
+class ProductService
8
+{
9
+    public static function isUsed(Product $product)
10
+    {
11
+        return $product->saleDetails()->exists()
12
+        || $product->stockProducts()->exists()
13
+        || $product->purchaseDetails()->exists();
14
+    }
15
+}

+ 1
- 1
database/migrations/2022_06_16_091443_create_sales_table.php Прегледај датотеку

@@ -15,7 +15,7 @@ return new class extends Migration
15 15
     {
16 16
         Schema::create('sales', function (Blueprint $table) {
17 17
             $table->id();
18
-            $table->string('number');
18
+            $table->string('number')->unique();
19 19
             $table->enum('status', ['pending', 'success']);
20 20
             $table->foreignId('customer_id')->constrained();
21 21
             $table->foreignId('user_id')->constrained();

+ 2
- 1
database/migrations/2022_06_17_115154_create_sale_details_table.php Прегледај датотеку

@@ -19,7 +19,8 @@ return new class extends Migration
19 19
             $table->unsignedInteger('ppn');
20 20
             $table->unsignedInteger('qty');
21 21
             $table->string('product_number');
22
-            $table->foreignId('sale_id')->constrained();
22
+            $table->string('sale_number');
23
+            $table->foreign('sale_number')->references('number')->on('sales');
23 24
             $table->foreign('product_number')->references('number')->on('products');
24 25
             $table->timestamps();
25 26
         });

+ 8
- 4
lang/en/messages.php Прегледај датотеку

@@ -47,7 +47,8 @@ return [
47 47
             'user' => 'User Account successfully changed',
48 48
             'customer' => 'Customer successfully changed',
49 49
             'supplier' => 'Supplier successfully changed',
50
-            'product' => 'Product successfully changed'
50
+            'product' => 'Product successfully changed',
51
+            'sale' => 'Sale successfully changed'
51 52
         ],
52 53
         'destroy' => [
53 54
             'type_member' => 'Jenis member successfully deleted',
@@ -56,7 +57,8 @@ return [
56 57
             'member' => 'Member Account successfully deleted',
57 58
             'user' => 'User Account successfully deleted',
58 59
             'customer' => 'Customer successfully deleted',
59
-            'product' => 'Product successfully deleted'
60
+            'product' => 'Product successfully deleted',
61
+            'supplier' => 'Supplier successfully deleted'
60 62
         ]
61 63
     ],
62 64
 
@@ -67,11 +69,13 @@ return [
67 69
             'member' => 'member failed to be added',
68 70
             'change_password' => 'Password invalid',
69 71
             'expense' => 'Expense failed to be added',
70
-            'transaction' => 'Transaction failed to be added'
72
+            'transaction' => 'Transaction failed to be added',
73
+            'sale' => 'Sale failed to be added'
71 74
         ],
72 75
         'update' => [
73 76
             'type_member' => 'Type member failed to be changed',
74
-            'member' => 'Member failed to be changed'
77
+            'member' => 'Member failed to be changed',
78
+            'sale' => 'Sale failed to be changed'
75 79
         ]
76 80
     ]
77 81
 ];

+ 8
- 4
lang/id/messages.php Прегледај датотеку

@@ -47,7 +47,8 @@ return [
47 47
             'user' => 'Akun user berhasil diubah',
48 48
             'customer' => 'Pelanggan berhasil diubah',
49 49
             'supplier' => 'Supplier berhasil diubah',
50
-            'product' => 'Produk berhasil diubah'
50
+            'product' => 'Produk berhasil diubah',
51
+            'sale' => 'Penjualan berhasil diubah'
51 52
         ],
52 53
         'destroy' => [
53 54
             'type_member' => 'Jenis member berhasil dihapus',
@@ -56,7 +57,8 @@ return [
56 57
             'member' => 'Akun member berhasil dihapus',
57 58
             'user' => 'Akun user berhasil dihapus',
58 59
             'customer' => 'Pelanggan berhasil dihapus',
59
-            'product' => 'Product berhasil dihapus'
60
+            'product' => 'Product berhasil dihapus',
61
+            'supplier' => 'Supplier berhasil dihapus'
60 62
         ]
61 63
     ],
62 64
 
@@ -67,11 +69,13 @@ return [
67 69
             'member' => 'Member gagal ditambahkan',
68 70
             'change_password' => 'Password lama salah',
69 71
             'expense' => 'Pengeluaran gagal ditambahkan',
70
-            'transaction' => 'Transaksi gagal ditambahkan'
72
+            'transaction' => 'Transaksi gagal ditambahkan',
73
+            'sale' => 'Penjualan gagal ditambahkan'
71 74
         ],
72 75
         'update' => [
73 76
             'type_member' => 'Jenis member gagal diubah',
74
-            'member' => 'Member gagal diubah'
77
+            'member' => 'Member gagal diubah',
78
+            'sale' => 'Penjualan gagal dibuah'
75 79
         ]
76 80
     ]
77 81
 ];

+ 9
- 43
public/js/resources_js_pages_Customers_Edit_vue.js Прегледај датотеку

@@ -310,13 +310,9 @@ __webpack_require__.r(__webpack_exports__);
310 310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311 311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312 312
 /* harmony export */ });
313
-/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
314
-/* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
315
-/* harmony import */ var _components_useForm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/useForm */ "./resources/js/components/useForm.js");
316
-/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
317
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
318
-
319
-
313
+/* harmony import */ var _components_useForm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/useForm */ "./resources/js/components/useForm.js");
314
+/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
315
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
320 316
 
321 317
 
322 318
 
@@ -329,28 +325,12 @@ __webpack_require__.r(__webpack_exports__);
329 325
     var expose = _ref.expose;
330 326
     expose();
331 327
     var props = __props;
332
-    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_2__.useForm)({
328
+    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm)({
333 329
       name: props.customer.name,
334 330
       address: props.customer.address,
335 331
       phone: props.customer.phone,
336 332
       npwp: props.customer.npwp
337 333
     });
338
-    var deleteConfirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm)();
339
-
340
-    var onDelete = function onDelete() {
341
-      deleteConfirm.require({
342
-        message: "Yakin akan menghapus (".concat(props.customer.name, ") ?"),
343
-        header: 'Hapus Pelanggan',
344
-        acceptLabel: 'Hapus',
345
-        rejectLabel: 'Batalkan',
346
-        accept: function accept() {
347
-          _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia["delete"](route('customers.destroy', props.customer.id));
348
-        },
349
-        reject: function reject() {
350
-          deleteConfirm.close();
351
-        }
352
-      });
353
-    };
354 334
 
355 335
     var onSubmit = function onSubmit() {
356 336
       form.put(route('customers.update', props.customer.id));
@@ -359,14 +339,10 @@ __webpack_require__.r(__webpack_exports__);
359 339
     var __returned__ = {
360 340
       props: props,
361 341
       form: form,
362
-      deleteConfirm: deleteConfirm,
363
-      onDelete: onDelete,
364 342
       onSubmit: onSubmit,
365
-      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
366
-      useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm,
367
-      useForm: _components_useForm__WEBPACK_IMPORTED_MODULE_2__.useForm,
368
-      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
369
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
343
+      useForm: _components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm,
344
+      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
345
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
370 346
     };
371 347
     Object.defineProperty(__returned__, '__isScriptSetup', {
372 348
       enumerable: false,
@@ -924,14 +900,9 @@ var _hoisted_9 = {
924 900
   "class": "grid"
925 901
 };
926 902
 var _hoisted_10 = {
927
-  "class": "col-12 md:col-6 flex flex-column md:flex-row justify-content-center md:justify-content-start"
928
-};
929
-var _hoisted_11 = {
930
-  "class": "col-12 md:col-6 flex flex-column md:flex-row justify-content-center md:justify-content-end"
903
+  "class": "col-12 flex flex-column md:flex-row justify-content-end"
931 904
 };
932 905
 function render(_ctx, _cache, $props, $setup, $data, $options) {
933
-  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
934
-
935 906
   var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
936 907
 
937 908
   var _component_Card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Card");
@@ -940,7 +911,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
940 911
     title: "Ubah Pelanggan"
941 912
   }, {
942 913
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
943
-      return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
914
+      return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_1, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_2, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Card, null, {
944 915
         title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
945 916
           return [_hoisted_3];
946 917
         }),
@@ -991,11 +962,6 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
991 962
         }),
992 963
         footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
993 964
           return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_9, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_10, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
994
-            label: "Hapus",
995
-            icon: "pi pi-trash",
996
-            "class": "p-button-outlined p-button-danger",
997
-            onClick: $setup.onDelete
998
-          })]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementVNode)("div", _hoisted_11, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Button, {
999 965
             label: "Simpan",
1000 966
             icon: "pi pi-check",
1001 967
             "class": "p-button-outlined",

+ 62
- 12
public/js/resources_js_pages_Customers_Index_vue.js Прегледај датотеку

@@ -383,11 +383,15 @@ __webpack_require__.r(__webpack_exports__);
383 383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384 384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385 385
 /* harmony export */ });
386
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Customers/config.js");
387
-/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
388
-/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
389
-/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
390
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
386
+/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
387
+/* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
388
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Customers/config.js");
389
+/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
390
+/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
391
+/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
392
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
393
+
394
+
391 395
 
392 396
 
393 397
 
@@ -402,12 +406,33 @@ __webpack_require__.r(__webpack_exports__);
402 406
   setup: function setup(__props, _ref) {
403 407
     var expose = _ref.expose;
404 408
     expose();
409
+    var deleteConfirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm)();
410
+
411
+    var onDelete = function onDelete(data) {
412
+      deleteConfirm.require({
413
+        message: "Yakin akan menghapus data (".concat(data.name, ") ?"),
414
+        header: 'Hapus Pelanggan',
415
+        acceptLabel: 'Iya',
416
+        rejectLabel: 'Tidak',
417
+        accept: function accept() {
418
+          _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia["delete"](route('customers.destroy', data.id));
419
+        },
420
+        reject: function reject() {
421
+          deleteConfirm.close();
422
+        }
423
+      });
424
+    };
425
+
405 426
     var __returned__ = {
406
-      indexTable: _config__WEBPACK_IMPORTED_MODULE_0__.indexTable,
407
-      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
408
-      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
409
-      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
410
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
427
+      deleteConfirm: deleteConfirm,
428
+      onDelete: onDelete,
429
+      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
430
+      useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm,
431
+      indexTable: _config__WEBPACK_IMPORTED_MODULE_2__.indexTable,
432
+      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
433
+      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
434
+      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
435
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__["default"]
411 436
     };
412 437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413 438
       enumerable: false,
@@ -1046,13 +1071,17 @@ var _hoisted_5 = {
1046 1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047 1072
 };
1048 1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049 1076
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1050 1077
 
1078
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1079
+
1051 1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052 1081
 
1053 1082
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
1054 1083
 
1055
-  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1084
+  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["DashboardLayout"], {
1056 1085
     title: "Daftar Pelanggan"
1057 1086
   }, {
1058 1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
@@ -1107,6 +1136,25 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1107 1136
             _: 1
1108 1137
             /* STABLE */
1109 1138
 
1139
+          }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1140
+            body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref2) {
1141
+              var data = _ref2.data;
1142
+              return [!data.isUsed ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Button, {
1143
+                key: 0,
1144
+                icon: "pi pi-trash",
1145
+                "class": "p-button-icon-only p-button-rounded p-button-text",
1146
+                onClick: function onClick($event) {
1147
+                  return $setup.onDelete(data);
1148
+                }
1149
+              }, null, 8
1150
+              /* PROPS */
1151
+              , ["onClick"])), [[_directive_tooltip, 'Hapus Pelanggan', void 0, {
1152
+                bottom: true
1153
+              }]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
1154
+            }),
1155
+            _: 1
1156
+            /* STABLE */
1157
+
1110 1158
           })];
1111 1159
         }),
1112 1160
         _: 1
@@ -1123,7 +1171,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1123 1171
     _: 1
1124 1172
     /* STABLE */
1125 1173
 
1126
-  });
1174
+  })], 64
1175
+  /* STABLE_FRAGMENT */
1176
+  );
1127 1177
 }
1128 1178
 
1129 1179
 /***/ }),

+ 35
- 5
public/js/resources_js_pages_Products_Create_vue.js Прегледај датотеку

@@ -310,8 +310,10 @@ __webpack_require__.r(__webpack_exports__);
310 310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311 311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312 312
 /* harmony export */ });
313
-/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
314
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
313
+/* harmony import */ var _components_useForm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/useForm */ "./resources/js/components/useForm.js");
314
+/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
315
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
316
+
315 317
 
316 318
 
317 319
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
@@ -323,7 +325,7 @@ __webpack_require__.r(__webpack_exports__);
323 325
     var expose = _ref.expose;
324 326
     expose();
325 327
     var props = __props;
326
-    var form = useForm({
328
+    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm)({
327 329
       number: props.number,
328 330
       name: null,
329 331
       unit: null
@@ -341,8 +343,9 @@ __webpack_require__.r(__webpack_exports__);
341 343
       props: props,
342 344
       form: form,
343 345
       onSubmit: onSubmit,
344
-      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
345
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
346
+      useForm: _components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm,
347
+      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
348
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
346 349
     };
347 350
     Object.defineProperty(__returned__, '__isScriptSetup', {
348 351
       enumerable: false,
@@ -964,6 +967,33 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
964 967
 
965 968
 /***/ }),
966 969
 
970
+/***/ "./resources/js/components/useForm.js":
971
+/*!********************************************!*\
972
+  !*** ./resources/js/components/useForm.js ***!
973
+  \********************************************/
974
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
975
+
976
+__webpack_require__.r(__webpack_exports__);
977
+/* harmony export */ __webpack_require__.d(__webpack_exports__, {
978
+/* harmony export */   "useForm": () => (/* binding */ useForm)
979
+/* harmony export */ });
980
+/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
981
+/* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
982
+
983
+
984
+function useForm(obj) {
985
+  var form = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.useForm)(obj);
986
+  var errors = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
987
+    return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors;
988
+  });
989
+  (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(errors, function () {
990
+    form.clearErrors();
991
+  });
992
+  return form;
993
+}
994
+
995
+/***/ }),
996
+
967 997
 /***/ "./resources/js/utils/menu.js":
968 998
 /*!************************************!*\
969 999
   !*** ./resources/js/utils/menu.js ***!

+ 35
- 5
public/js/resources_js_pages_Products_Edit_vue.js Прегледај датотеку

@@ -310,8 +310,10 @@ __webpack_require__.r(__webpack_exports__);
310 310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311 311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312 312
 /* harmony export */ });
313
-/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
314
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
313
+/* harmony import */ var _components_useForm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/components/useForm */ "./resources/js/components/useForm.js");
314
+/* harmony import */ var _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppInputText.vue */ "./resources/js/components/AppInputText.vue");
315
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
316
+
315 317
 
316 318
 
317 319
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
@@ -323,7 +325,7 @@ __webpack_require__.r(__webpack_exports__);
323 325
     var expose = _ref.expose;
324 326
     expose();
325 327
     var props = __props;
326
-    var form = useForm({
328
+    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm)({
327 329
       number: props.product.number,
328 330
       name: props.product.name,
329 331
       unit: props.product.unit
@@ -337,8 +339,9 @@ __webpack_require__.r(__webpack_exports__);
337 339
       props: props,
338 340
       form: form,
339 341
       onSubmit: onSubmit,
340
-      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
341
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
342
+      useForm: _components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm,
343
+      AppInputText: _components_AppInputText_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
344
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_2__["default"]
342 345
     };
343 346
     Object.defineProperty(__returned__, '__isScriptSetup', {
344 347
       enumerable: false,
@@ -963,6 +966,33 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
963 966
 
964 967
 /***/ }),
965 968
 
969
+/***/ "./resources/js/components/useForm.js":
970
+/*!********************************************!*\
971
+  !*** ./resources/js/components/useForm.js ***!
972
+  \********************************************/
973
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
974
+
975
+__webpack_require__.r(__webpack_exports__);
976
+/* harmony export */ __webpack_require__.d(__webpack_exports__, {
977
+/* harmony export */   "useForm": () => (/* binding */ useForm)
978
+/* harmony export */ });
979
+/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.esm-bundler.js");
980
+/* harmony import */ var _inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inertiajs/inertia-vue3 */ "./node_modules/@inertiajs/inertia-vue3/dist/index.js");
981
+
982
+
983
+function useForm(obj) {
984
+  var form = (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.useForm)(obj);
985
+  var errors = (0,vue__WEBPACK_IMPORTED_MODULE_0__.computed)(function () {
986
+    return (0,_inertiajs_inertia_vue3__WEBPACK_IMPORTED_MODULE_1__.usePage)().props.value.errors;
987
+  });
988
+  (0,vue__WEBPACK_IMPORTED_MODULE_0__.watch)(errors, function () {
989
+    form.clearErrors();
990
+  });
991
+  return form;
992
+}
993
+
994
+/***/ }),
995
+
966 996
 /***/ "./resources/js/utils/menu.js":
967 997
 /*!************************************!*\
968 998
   !*** ./resources/js/utils/menu.js ***!

+ 63
- 13
public/js/resources_js_pages_Products_Index_vue.js Прегледај датотеку

@@ -383,11 +383,15 @@ __webpack_require__.r(__webpack_exports__);
383 383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384 384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385 385
 /* harmony export */ });
386
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Products/config.js");
387
-/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
388
-/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
389
-/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
390
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
386
+/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
387
+/* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
388
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Products/config.js");
389
+/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
390
+/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
391
+/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
392
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
393
+
394
+
391 395
 
392 396
 
393 397
 
@@ -402,12 +406,33 @@ __webpack_require__.r(__webpack_exports__);
402 406
   setup: function setup(__props, _ref) {
403 407
     var expose = _ref.expose;
404 408
     expose();
409
+    var deleteConfirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm)();
410
+
411
+    var onDelete = function onDelete(data) {
412
+      deleteConfirm.require({
413
+        message: "Yakin akan menghapus data (".concat(data.name, ") ?"),
414
+        header: 'Hapus Produk',
415
+        acceptLabel: 'Iya',
416
+        rejectLabel: 'Tidak',
417
+        accept: function accept() {
418
+          _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia["delete"](route('products.destroy', data.id));
419
+        },
420
+        reject: function reject() {
421
+          deleteConfirm.close();
422
+        }
423
+      });
424
+    };
425
+
405 426
     var __returned__ = {
406
-      indexTable: _config__WEBPACK_IMPORTED_MODULE_0__.indexTable,
407
-      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
408
-      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
409
-      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
410
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
427
+      deleteConfirm: deleteConfirm,
428
+      onDelete: onDelete,
429
+      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
430
+      useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm,
431
+      indexTable: _config__WEBPACK_IMPORTED_MODULE_2__.indexTable,
432
+      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
433
+      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
434
+      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
435
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__["default"]
411 436
     };
412 437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413 438
       enumerable: false,
@@ -1046,13 +1071,17 @@ var _hoisted_5 = {
1046 1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047 1072
 };
1048 1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049 1076
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1050 1077
 
1078
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1079
+
1051 1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052 1081
 
1053 1082
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
1054 1083
 
1055
-  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1084
+  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["DashboardLayout"], {
1056 1085
     title: "Daftar Produk"
1057 1086
   }, {
1058 1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
@@ -1100,13 +1129,32 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1100 1129
                 href: _ctx.route('products.edit', data.id)
1101 1130
               }, null, 8
1102 1131
               /* PROPS */
1103
-              , ["href"]), [[_directive_tooltip, 'Ubah Pelanggan', void 0, {
1132
+              , ["href"]), [[_directive_tooltip, 'Ubah Produk', void 0, {
1104 1133
                 bottom: true
1105 1134
               }]])];
1106 1135
             }),
1107 1136
             _: 1
1108 1137
             /* STABLE */
1109 1138
 
1139
+          }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1140
+            body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref2) {
1141
+              var data = _ref2.data;
1142
+              return [!data.isUsed ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Button, {
1143
+                key: 0,
1144
+                icon: "pi pi-trash",
1145
+                "class": "p-button-icon-only p-button-rounded p-button-text",
1146
+                onClick: function onClick($event) {
1147
+                  return $setup.onDelete(data);
1148
+                }
1149
+              }, null, 8
1150
+              /* PROPS */
1151
+              , ["onClick"])), [[_directive_tooltip, 'Hapus Produk', void 0, {
1152
+                bottom: true
1153
+              }]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
1154
+            }),
1155
+            _: 1
1156
+            /* STABLE */
1157
+
1110 1158
           })];
1111 1159
         }),
1112 1160
         _: 1
@@ -1123,7 +1171,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1123 1171
     _: 1
1124 1172
     /* STABLE */
1125 1173
 
1126
-  });
1174
+  })], 64
1175
+  /* STABLE_FRAGMENT */
1176
+  );
1127 1177
 }
1128 1178
 
1129 1179
 /***/ }),

+ 3
- 3
public/js/resources_js_pages_Sales_Create_vue.js Прегледај датотеку

@@ -833,7 +833,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
833 833
           price: data.price,
834 834
           qty: data.qty,
835 835
           customer_id: data.customer.id,
836
-          product_id: data.product.number
836
+          product_number: data.product.number
837 837
         };
838 838
       }).post(route('sales.store'), {
839 839
         onSuccess: function onSuccess() {
@@ -2117,7 +2117,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2117 2117
             "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) {
2118 2118
               return $setup.form.product = $event;
2119 2119
             }),
2120
-            error: $setup.form.errors.product_id,
2120
+            error: $setup.form.errors.product_number,
2121 2121
             suggestions: $props.products
2122 2122
           }, {
2123 2123
             item: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (slotProps) {
@@ -2240,7 +2240,7 @@ var optionStatus = [{
2240 2240
   label: 'Pending',
2241 2241
   value: 'pending'
2242 2242
 }, {
2243
-  label: 'Berhasil',
2243
+  label: 'Success',
2244 2244
   value: 'success'
2245 2245
 }];
2246 2246
 var indexTable = [{

+ 2637
- 0
public/js/resources_js_pages_Sales_Edit_vue.js
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 12
- 2
public/js/resources_js_pages_Sales_Index_vue.js Прегледај датотеку

@@ -1050,6 +1050,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1050 1050
 
1051 1051
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052 1052
 
1053
+  var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
1054
+
1053 1055
   return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1054 1056
     title: "Daftar Penjualan"
1055 1057
   }, {
@@ -1092,7 +1094,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1092 1094
           )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1093 1095
             body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
1094 1096
               var data = _ref.data;
1095
-              return [];
1097
+              return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)((0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["AppButtonLink"], {
1098
+                icon: "pi pi-pencil",
1099
+                "class": "p-button-icon-only p-button-rounded p-button-text",
1100
+                href: _ctx.route('sales.edit', data.id)
1101
+              }, null, 8
1102
+              /* PROPS */
1103
+              , ["href"]), [[_directive_tooltip, 'Ubah Penjualan', void 0, {
1104
+                bottom: true
1105
+              }]])];
1096 1106
             }),
1097 1107
             _: 1
1098 1108
             /* STABLE */
@@ -1135,7 +1145,7 @@ var optionStatus = [{
1135 1145
   label: 'Pending',
1136 1146
   value: 'pending'
1137 1147
 }, {
1138
-  label: 'Berhasil',
1148
+  label: 'Success',
1139 1149
   value: 'success'
1140 1150
 }];
1141 1151
 var indexTable = [{

+ 1
- 1
public/js/resources_js_pages_Sales_config_js.js Прегледај датотеку

@@ -17,7 +17,7 @@ var optionStatus = [{
17 17
   label: 'Pending',
18 18
   value: 'pending'
19 19
 }, {
20
-  label: 'Berhasil',
20
+  label: 'Success',
21 21
   value: 'success'
22 22
 }];
23 23
 var indexTable = [{

+ 62
- 12
public/js/resources_js_pages_Suppliers_Index_vue.js Прегледај датотеку

@@ -383,11 +383,15 @@ __webpack_require__.r(__webpack_exports__);
383 383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384 384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385 385
 /* harmony export */ });
386
-/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Suppliers/config.js");
387
-/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
388
-/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
389
-/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
390
-/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
386
+/* harmony import */ var _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inertiajs/inertia */ "./node_modules/@inertiajs/inertia/dist/index.js");
387
+/* harmony import */ var primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! primevue/useconfirm */ "./node_modules/primevue/useconfirm/useconfirm.esm.js");
388
+/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./resources/js/pages/Suppliers/config.js");
389
+/* harmony import */ var _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/components/AppSearch.vue */ "./resources/js/components/AppSearch.vue");
390
+/* harmony import */ var _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @/components/AppButtonLink.vue */ "./resources/js/components/AppButtonLink.vue");
391
+/* harmony import */ var _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @/components/AppPagination.vue */ "./resources/js/components/AppPagination.vue");
392
+/* harmony import */ var _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @/layouts/Dashboard/DashboardLayout.vue */ "./resources/js/layouts/Dashboard/DashboardLayout.vue");
393
+
394
+
391 395
 
392 396
 
393 397
 
@@ -402,12 +406,33 @@ __webpack_require__.r(__webpack_exports__);
402 406
   setup: function setup(__props, _ref) {
403 407
     var expose = _ref.expose;
404 408
     expose();
409
+    var deleteConfirm = (0,primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm)();
410
+
411
+    var onDelete = function onDelete(data) {
412
+      deleteConfirm.require({
413
+        message: "Yakin akan menghapus data (".concat(data.name, ") ?"),
414
+        header: 'Hapus Supplier',
415
+        acceptLabel: 'Iya',
416
+        rejectLabel: 'Tidak',
417
+        accept: function accept() {
418
+          _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia["delete"](route('suppliers.destroy', data.id));
419
+        },
420
+        reject: function reject() {
421
+          deleteConfirm.close();
422
+        }
423
+      });
424
+    };
425
+
405 426
     var __returned__ = {
406
-      indexTable: _config__WEBPACK_IMPORTED_MODULE_0__.indexTable,
407
-      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
408
-      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
409
-      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
410
-      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
427
+      deleteConfirm: deleteConfirm,
428
+      onDelete: onDelete,
429
+      Inertia: _inertiajs_inertia__WEBPACK_IMPORTED_MODULE_0__.Inertia,
430
+      useConfirm: primevue_useconfirm__WEBPACK_IMPORTED_MODULE_1__.useConfirm,
431
+      indexTable: _config__WEBPACK_IMPORTED_MODULE_2__.indexTable,
432
+      AppSearch: _components_AppSearch_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
433
+      AppButtonLink: _components_AppButtonLink_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
434
+      AppPagination: _components_AppPagination_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
435
+      DashboardLayout: _layouts_Dashboard_DashboardLayout_vue__WEBPACK_IMPORTED_MODULE_6__["default"]
411 436
     };
412 437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413 438
       enumerable: false,
@@ -1046,13 +1071,17 @@ var _hoisted_5 = {
1046 1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047 1072
 };
1048 1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049 1076
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
1050 1077
 
1078
+  var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
1079
+
1051 1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052 1081
 
1053 1082
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
1054 1083
 
1055
-  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1084
+  return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createElementBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_ConfirmDialog), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)($setup["DashboardLayout"], {
1056 1085
     title: "Daftar Supplier"
1057 1086
   }, {
1058 1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
@@ -1107,6 +1136,25 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1107 1136
             _: 1
1108 1137
             /* STABLE */
1109 1138
 
1139
+          }), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1140
+            body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref2) {
1141
+              var data = _ref2.data;
1142
+              return [!data.isUsed ? (0,vue__WEBPACK_IMPORTED_MODULE_0__.withDirectives)(((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_Button, {
1143
+                key: 0,
1144
+                icon: "pi pi-trash",
1145
+                "class": "p-button-icon-only p-button-rounded p-button-text",
1146
+                onClick: function onClick($event) {
1147
+                  return $setup.onDelete(data);
1148
+                }
1149
+              }, null, 8
1150
+              /* PROPS */
1151
+              , ["onClick"])), [[_directive_tooltip, 'Hapus Supplier', void 0, {
1152
+                bottom: true
1153
+              }]]) : (0,vue__WEBPACK_IMPORTED_MODULE_0__.createCommentVNode)("v-if", true)];
1154
+            }),
1155
+            _: 1
1156
+            /* STABLE */
1157
+
1110 1158
           })];
1111 1159
         }),
1112 1160
         _: 1
@@ -1123,7 +1171,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1123 1171
     _: 1
1124 1172
     /* STABLE */
1125 1173
 
1126
-  });
1174
+  })], 64
1175
+  /* STABLE_FRAGMENT */
1176
+  );
1127 1177
 }
1128 1178
 
1129 1179
 /***/ }),

+ 9
- 1
public/js/vue.js Прегледај датотеку

@@ -58623,6 +58623,14 @@ var map = {
58623 58623
 		"./resources/js/pages/Sales/Create.vue",
58624 58624
 		"resources_js_pages_Sales_Create_vue"
58625 58625
 	],
58626
+	"./Sales/Edit": [
58627
+		"./resources/js/pages/Sales/Edit.vue",
58628
+		"resources_js_pages_Sales_Edit_vue"
58629
+	],
58630
+	"./Sales/Edit.vue": [
58631
+		"./resources/js/pages/Sales/Edit.vue",
58632
+		"resources_js_pages_Sales_Edit_vue"
58633
+	],
58626 58634
 	"./Sales/Index": [
58627 58635
 		"./resources/js/pages/Sales/Index.vue",
58628 58636
 		"resources_js_pages_Sales_Index_vue"
@@ -58836,7 +58844,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
58836 58844
 /******/ 		// This function allow to reference async chunks
58837 58845
 /******/ 		__webpack_require__.u = (chunkId) => {
58838 58846
 /******/ 			// return url for filenames based on template
58839
-/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"9296b829a7757dee","resources_js_pages_Auth_Login_vue":"be578e085a239e29","resources_js_pages_Customers_Create_vue":"3f071508eabc668b","resources_js_pages_Customers_Edit_vue":"aebd0864e4ad3e68","resources_js_pages_Customers_Index_vue":"1e494ee438fa9df6","resources_js_pages_Customers_config_js":"3e69b9c9add806c6","resources_js_pages_Dashboards_Index_vue":"d3d4e8305b123375","resources_js_pages_Error_Index_vue":"4119ff1c60260652","resources_js_pages_Products_Create_vue":"654f3597a7f836a8","resources_js_pages_Products_Edit_vue":"92630d22ca001222","resources_js_pages_Products_Index_vue":"f21347c772e5a78b","resources_js_pages_Products_config_js":"885a5522b0477687","resources_js_pages_Purchases_Index_vue":"b4137df9a769fdf3","resources_js_pages_Sales_Components_Dialog_CustomerCreate_vue":"0e45b005d2175423","resources_js_pages_Sales_Components_Dialog_ProductCreate_vue":"26ef1d3355ba7e47","resources_js_pages_Sales_Components_SaleDetails_vue":"b0aacea6649cd1d1","resources_js_pages_Sales_Create_vue":"e90f4bf66d9a6f95","resources_js_pages_Sales_Index_vue":"ea504c94494d14bb","resources_js_pages_Sales_config_js":"130f88fd092690ee","resources_js_pages_StockProducts_Index_vue":"7f6b33a4fbab582d","resources_js_pages_Suppliers_Create_vue":"c013262c0e5fb7ee","resources_js_pages_Suppliers_Edit_vue":"c026816d9eff6a88","resources_js_pages_Suppliers_Index_vue":"96c102e92f653886","resources_js_pages_Suppliers_config_js":"52e8d25c6bfab54b","resources_js_pages_Users_Create_vue":"efad98f9f2b8dba6","resources_js_pages_Users_Edit_vue":"a5c8a2cdddf14020","resources_js_pages_Users_Index_vue":"bcd25543a8cc6f19","resources_js_pages_Users_Show_vue":"1e641b8d61834507","resources_js_pages_Users_config_js":"92384d78612abc88"}[chunkId] + "";
58847
+/******/ 			return "js/" + chunkId + ".js?id=" + {"node_modules_chart_js_auto_auto_esm_js":"9296b829a7757dee","resources_js_pages_Auth_Login_vue":"be578e085a239e29","resources_js_pages_Customers_Create_vue":"3f071508eabc668b","resources_js_pages_Customers_Edit_vue":"b195d54357f43a2d","resources_js_pages_Customers_Index_vue":"6882e2ddc4f886c0","resources_js_pages_Customers_config_js":"3e69b9c9add806c6","resources_js_pages_Dashboards_Index_vue":"d3d4e8305b123375","resources_js_pages_Error_Index_vue":"4119ff1c60260652","resources_js_pages_Products_Create_vue":"9a60a13d33678f2b","resources_js_pages_Products_Edit_vue":"213fbd014f856c8f","resources_js_pages_Products_Index_vue":"e5eb059406afbe3f","resources_js_pages_Products_config_js":"885a5522b0477687","resources_js_pages_Purchases_Index_vue":"b4137df9a769fdf3","resources_js_pages_Sales_Components_Dialog_CustomerCreate_vue":"0e45b005d2175423","resources_js_pages_Sales_Components_Dialog_ProductCreate_vue":"26ef1d3355ba7e47","resources_js_pages_Sales_Components_SaleDetails_vue":"b0aacea6649cd1d1","resources_js_pages_Sales_Create_vue":"7c3ad48c918ffd4a","resources_js_pages_Sales_Edit_vue":"5ad741e047bbf9ea","resources_js_pages_Sales_Index_vue":"f19c9fbcd01218cf","resources_js_pages_Sales_config_js":"c4816c15a415fd36","resources_js_pages_StockProducts_Index_vue":"7f6b33a4fbab582d","resources_js_pages_Suppliers_Create_vue":"c013262c0e5fb7ee","resources_js_pages_Suppliers_Edit_vue":"c026816d9eff6a88","resources_js_pages_Suppliers_Index_vue":"ecce1594ff033787","resources_js_pages_Suppliers_config_js":"52e8d25c6bfab54b","resources_js_pages_Users_Create_vue":"efad98f9f2b8dba6","resources_js_pages_Users_Edit_vue":"a5c8a2cdddf14020","resources_js_pages_Users_Index_vue":"bcd25543a8cc6f19","resources_js_pages_Users_Show_vue":"1e641b8d61834507","resources_js_pages_Users_config_js":"92384d78612abc88"}[chunkId] + "";
58840 58848
 /******/ 		};
58841 58849
 /******/ 	})();
58842 58850
 /******/ 	

+ 1
- 0
resources/js/components/AppDropdown.vue Прегледај датотеку

@@ -59,6 +59,7 @@ const selectedDropdownLabel = (value) => {
59 59
   const result = props.options.find(
60 60
     (option) => option[props.optionValue] == value
61 61
   )
62
+
62 63
   if (result) {
63 64
     return result[props.optionLabel]
64 65
   }

+ 1
- 33
resources/js/pages/Customers/Edit.vue Прегледај датотеку

@@ -1,6 +1,4 @@
1 1
 <script setup>
2
-import { Inertia } from '@inertiajs/inertia'
3
-import { useConfirm } from 'primevue/useconfirm'
4 2
 import { useForm } from '@/components/useForm'
5 3
 import AppInputText from '@/components/AppInputText.vue'
6 4
 import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
@@ -16,23 +14,6 @@ const form = useForm({
16 14
   npwp: props.customer.npwp,
17 15
 })
18 16
 
19
-const deleteConfirm = useConfirm()
20
-
21
-const onDelete = () => {
22
-  deleteConfirm.require({
23
-    message: `Yakin akan menghapus (${props.customer.name}) ?`,
24
-    header: 'Hapus Pelanggan',
25
-    acceptLabel: 'Hapus',
26
-    rejectLabel: 'Batalkan',
27
-    accept: () => {
28
-      Inertia.delete(route('customers.destroy', props.customer.id))
29
-    },
30
-    reject: () => {
31
-      deleteConfirm.close()
32
-    },
33
-  })
34
-}
35
-
36 17
 const onSubmit = () => {
37 18
   form.put(route('customers.update', props.customer.id))
38 19
 }
@@ -40,8 +21,6 @@ const onSubmit = () => {
40 21
 
41 22
 <template>
42 23
   <DashboardLayout title="Ubah Pelanggan">
43
-    <ConfirmDialog />
44
-
45 24
     <div class="grid">
46 25
       <div class="col-12 lg:col-8">
47 26
         <Card>
@@ -91,18 +70,7 @@ const onSubmit = () => {
91 70
           <template #footer>
92 71
             <div class="grid">
93 72
               <div
94
-                class="col-12 md:col-6 flex flex-column md:flex-row justify-content-center md:justify-content-start"
95
-              >
96
-                <Button
97
-                  label="Hapus"
98
-                  icon="pi pi-trash"
99
-                  class="p-button-outlined p-button-danger"
100
-                  @click="onDelete"
101
-                />
102
-              </div>
103
-
104
-              <div
105
-                class="col-12 md:col-6 flex flex-column md:flex-row justify-content-center md:justify-content-end"
73
+                class="col-12 flex flex-column md:flex-row justify-content-end"
106 74
               >
107 75
                 <Button
108 76
                   label="Simpan"

+ 33
- 0
resources/js/pages/Customers/Index.vue Прегледај датотеку

@@ -1,4 +1,6 @@
1 1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2 4
 import { indexTable } from './config'
3 5
 import AppSearch from '@/components/AppSearch.vue'
4 6
 import AppButtonLink from '@/components/AppButtonLink.vue'
@@ -9,9 +11,28 @@ defineProps({
9 11
   customers: Object,
10 12
   initialSearch: String,
11 13
 })
14
+
15
+const deleteConfirm = useConfirm()
16
+
17
+const onDelete = (data) => {
18
+  deleteConfirm.require({
19
+    message: `Yakin akan menghapus data (${data.name}) ?`,
20
+    header: 'Hapus Pelanggan',
21
+    acceptLabel: 'Iya',
22
+    rejectLabel: 'Tidak',
23
+    accept: () => {
24
+      Inertia.delete(route('customers.destroy', data.id))
25
+    },
26
+    reject: () => {
27
+      deleteConfirm.close()
28
+    },
29
+  })
30
+}
12 31
 </script>
13 32
 
14 33
 <template>
34
+  <ConfirmDialog />
35
+
15 36
   <DashboardLayout title="Daftar Pelanggan">
16 37
     <DataTable
17 38
       responsiveLayout="scroll"
@@ -65,6 +86,18 @@ defineProps({
65 86
           />
66 87
         </template>
67 88
       </Column>
89
+
90
+      <Column>
91
+        <template #body="{ data }">
92
+          <Button
93
+            v-if="!data.isUsed"
94
+            icon="pi pi-trash"
95
+            class="p-button-icon-only p-button-rounded p-button-text"
96
+            v-tooltip.bottom="'Hapus Pelanggan'"
97
+            @click="onDelete(data)"
98
+          />
99
+        </template>
100
+      </Column>
68 101
     </DataTable>
69 102
 
70 103
     <AppPagination :links="customers.links" />

+ 2
- 0
resources/js/pages/Products/Create.vue Прегледај датотеку

@@ -1,4 +1,5 @@
1 1
 <script setup>
2
+import { useForm } from '@/components/useForm'
2 3
 import AppInputText from '@/components/AppInputText.vue'
3 4
 import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
4 5
 
@@ -53,6 +54,7 @@ const onSubmit = () => {
53 54
                 />
54 55
               </div>
55 56
             </div>
57
+
56 58
             <div class="flex flex-column md:flex-row justify-content-end">
57 59
               <Button
58 60
                 label="Simpan"

+ 1
- 0
resources/js/pages/Products/Edit.vue Прегледај датотеку

@@ -1,4 +1,5 @@
1 1
 <script setup>
2
+import { useForm } from '@/components/useForm'
2 3
 import AppInputText from '@/components/AppInputText.vue'
3 4
 import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
4 5
 

+ 34
- 1
resources/js/pages/Products/Index.vue Прегледај датотеку

@@ -1,4 +1,6 @@
1 1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2 4
 import { indexTable } from './config'
3 5
 import AppSearch from '@/components/AppSearch.vue'
4 6
 import AppButtonLink from '@/components/AppButtonLink.vue'
@@ -9,9 +11,28 @@ defineProps({
9 11
   products: Object,
10 12
   initialSearch: String,
11 13
 })
14
+
15
+const deleteConfirm = useConfirm()
16
+
17
+const onDelete = (data) => {
18
+  deleteConfirm.require({
19
+    message: `Yakin akan menghapus data (${data.name}) ?`,
20
+    header: 'Hapus Produk',
21
+    acceptLabel: 'Iya',
22
+    rejectLabel: 'Tidak',
23
+    accept: () => {
24
+      Inertia.delete(route('products.destroy', data.id))
25
+    },
26
+    reject: () => {
27
+      deleteConfirm.close()
28
+    },
29
+  })
30
+}
12 31
 </script>
13 32
 
14 33
 <template>
34
+  <ConfirmDialog />
35
+
15 36
   <DashboardLayout title="Daftar Produk">
16 37
     <DataTable
17 38
       responsiveLayout="scroll"
@@ -60,11 +81,23 @@ defineProps({
60 81
           <AppButtonLink
61 82
             icon="pi pi-pencil"
62 83
             class="p-button-icon-only p-button-rounded p-button-text"
63
-            v-tooltip.bottom="'Ubah Pelanggan'"
84
+            v-tooltip.bottom="'Ubah Produk'"
64 85
             :href="route('products.edit', data.id)"
65 86
           />
66 87
         </template>
67 88
       </Column>
89
+
90
+      <Column>
91
+        <template #body="{ data }">
92
+          <Button
93
+            v-if="!data.isUsed"
94
+            icon="pi pi-trash"
95
+            class="p-button-icon-only p-button-rounded p-button-text"
96
+            v-tooltip.bottom="'Hapus Produk'"
97
+            @click="onDelete(data)"
98
+          />
99
+        </template>
100
+      </Column>
68 101
     </DataTable>
69 102
 
70 103
     <AppPagination :links="products.links" />

+ 2
- 2
resources/js/pages/Sales/Create.vue Прегледај датотеку

@@ -40,7 +40,7 @@ const onSubmit = () => {
40 40
       price: data.price,
41 41
       qty: data.qty,
42 42
       customer_id: data.customer.id,
43
-      product_id: data.product.number,
43
+      product_number: data.product.number,
44 44
     }))
45 45
     .post(route('sales.store'), {
46 46
       onSuccess: () => form.reset(),
@@ -144,7 +144,7 @@ const checkSales = () => {
144 144
                   field="name"
145 145
                   refresh-data="products"
146 146
                   v-model="form.product"
147
-                  :error="form.errors.product_id"
147
+                  :error="form.errors.product_number"
148 148
                   :suggestions="products"
149 149
                 >
150 150
                   <template #item="slotProps">

+ 90
- 0
resources/js/pages/Sales/Edit.vue Прегледај датотеку

@@ -0,0 +1,90 @@
1
+<script setup>
2
+import { useForm } from '@/components/useForm'
3
+import { optionStatus } from './config'
4
+import AppDropdown from '@/components/AppDropdown.vue'
5
+import AppInputNumber from '@/components/AppInputNumber.vue'
6
+import AppInputText from '@/components/AppInputText.vue'
7
+import SaleDetails from './Components/SaleDetails.vue'
8
+import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
9
+
10
+const props = defineProps({
11
+  sale: Object,
12
+})
13
+
14
+const form = useForm({
15
+  status: props.sale.status.value,
16
+  price: props.sale.price,
17
+  qty: props.sale.qty,
18
+})
19
+
20
+const onSubmit = () => {
21
+  form.put(route('sales.update', props.sale.id))
22
+}
23
+</script>
24
+
25
+<template>
26
+  <DashboardLayout title="Ubah Penjualan">
27
+    <div class="grid">
28
+      <div class="col-12 lg:col-8">
29
+        <Card>
30
+          <template #title> Ubah Penjualan </template>
31
+          <template #content>
32
+            <div class="grid">
33
+              <div class="col-12 md:col-6">
34
+                <AppDropdown
35
+                  label="Status"
36
+                  placeholder="status"
37
+                  :options="optionStatus"
38
+                  :error="form.errors.status"
39
+                  v-model="form.status"
40
+                />
41
+              </div>
42
+
43
+              <div class="col-12 md:col-6">
44
+                <AppInputNumber
45
+                  label="Harga"
46
+                  placeholder="harga"
47
+                  :error="form.errors.price"
48
+                  v-model="form.price"
49
+                />
50
+              </div>
51
+
52
+              <div class="col-12 md:col-6">
53
+                <AppInputText
54
+                  label="Kuantitas"
55
+                  placeholder="kuantitas"
56
+                  type="number"
57
+                  :error="form.errors.qty"
58
+                  v-model="form.qty"
59
+                />
60
+              </div>
61
+            </div>
62
+          </template>
63
+
64
+          <template #footer>
65
+            <div class="flex flex-column md:flex-row justify-content-end">
66
+              <Button
67
+                label="Simpan"
68
+                icon="pi pi-check"
69
+                class="p-button-outlined"
70
+                :disabled="form.processing"
71
+                @click="onSubmit"
72
+              />
73
+            </div>
74
+          </template>
75
+        </Card>
76
+      </div>
77
+
78
+      <div class="col-12 lg:col-4">
79
+        <SaleDetails
80
+          :sale-number="sale.number"
81
+          :sale-price="form.price"
82
+          :sale-qty="form.qty"
83
+          :sale-status="form.status"
84
+          :customer="sale.customer"
85
+          :product="sale.product"
86
+        />
87
+      </div>
88
+    </div>
89
+  </DashboardLayout>
90
+</template>

+ 8
- 1
resources/js/pages/Sales/Index.vue Прегледај датотеку

@@ -56,7 +56,14 @@ defineProps({
56 56
       />
57 57
 
58 58
       <Column>
59
-        <template #body="{ data }"> </template>
59
+        <template #body="{ data }">
60
+          <AppButtonLink
61
+            icon="pi pi-pencil"
62
+            class="p-button-icon-only p-button-rounded p-button-text"
63
+            v-tooltip.bottom="'Ubah Penjualan'"
64
+            :href="route('sales.edit', data.id)"
65
+          />
66
+        </template>
60 67
       </Column>
61 68
     </DataTable>
62 69
 

+ 1
- 1
resources/js/pages/Sales/config.js Прегледај датотеку

@@ -4,7 +4,7 @@ export const optionStatus = [
4 4
     value: 'pending',
5 5
   },
6 6
   {
7
-    label: 'Berhasil',
7
+    label: 'Success',
8 8
     value: 'success',
9 9
   },
10 10
 ]

+ 33
- 0
resources/js/pages/Suppliers/Index.vue Прегледај датотеку

@@ -1,4 +1,6 @@
1 1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2 4
 import { indexTable } from './config'
3 5
 import AppSearch from '@/components/AppSearch.vue'
4 6
 import AppButtonLink from '@/components/AppButtonLink.vue'
@@ -9,9 +11,28 @@ defineProps({
9 11
   suppliers: Object,
10 12
   initialSearch: String,
11 13
 })
14
+
15
+const deleteConfirm = useConfirm()
16
+
17
+const onDelete = (data) => {
18
+  deleteConfirm.require({
19
+    message: `Yakin akan menghapus data (${data.name}) ?`,
20
+    header: 'Hapus Supplier',
21
+    acceptLabel: 'Iya',
22
+    rejectLabel: 'Tidak',
23
+    accept: () => {
24
+      Inertia.delete(route('suppliers.destroy', data.id))
25
+    },
26
+    reject: () => {
27
+      deleteConfirm.close()
28
+    },
29
+  })
30
+}
12 31
 </script>
13 32
 
14 33
 <template>
34
+  <ConfirmDialog />
35
+
15 36
   <DashboardLayout title="Daftar Supplier">
16 37
     <DataTable
17 38
       responsiveLayout="scroll"
@@ -65,6 +86,18 @@ defineProps({
65 86
           />
66 87
         </template>
67 88
       </Column>
89
+
90
+      <Column>
91
+        <template #body="{ data }">
92
+          <Button
93
+            v-if="!data.isUsed"
94
+            icon="pi pi-trash"
95
+            class="p-button-icon-only p-button-rounded p-button-text"
96
+            v-tooltip.bottom="'Hapus Supplier'"
97
+            @click="onDelete(data)"
98
+          />
99
+        </template>
100
+      </Column>
68 101
     </DataTable>
69 102
 
70 103
     <AppPagination :links="suppliers.links" />