Browse Source

fix: master

Muhammad Iqbal Afandi 4 years ago
parent
commit
84cd7e0b01
41 changed files with 3318 additions and 179 deletions
  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 View File

31
                     'name' => $customer->name,
31
                     'name' => $customer->name,
32
                     'address' => $customer->address,
32
                     'address' => $customer->address,
33
                     'phone' => $customer->phone,
33
                     'phone' => $customer->phone,
34
-                    'npwp' => $customer->npwp
34
+                    'npwp' => $customer->npwp,
35
+                    'isUsed' => $customer->sales()->exists()
35
                 ])
36
                 ])
36
         ]);
37
         ]);
37
     }
38
     }
105
     {
106
     {
106
         $customer->delete();
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 View File

5
 use App\Http\Requests\Product\StoreProductRequest;
5
 use App\Http\Requests\Product\StoreProductRequest;
6
 use App\Http\Requests\Product\UpdateProductRequest;
6
 use App\Http\Requests\Product\UpdateProductRequest;
7
 use App\Models\Product;
7
 use App\Models\Product;
8
+use App\Services\ProductService;
8
 use Inertia\Inertia;
9
 use Inertia\Inertia;
9
 
10
 
10
 class ProductController extends Controller
11
 class ProductController extends Controller
26
                     'id' => $product->id,
27
                     'id' => $product->id,
27
                     'number' => $product->number,
28
                     'number' => $product->number,
28
                     'name' => $product->name,
29
                     'name' => $product->name,
29
-                    'unit' => $product->unit
30
+                    'unit' => $product->unit,
31
+                    'isUsed' => ProductService::isUsed($product)
30
                 ])
32
                 ])
31
         ]);
33
         ]);
32
     }
34
     }
102
     {
104
     {
103
         $product->delete();
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 View File

3
 namespace App\Http\Controllers;
3
 namespace App\Http\Controllers;
4
 
4
 
5
 use App\Http\Requests\Sales\StoreSaleRequest;
5
 use App\Http\Requests\Sales\StoreSaleRequest;
6
+use App\Http\Requests\Sales\UpdateSaleRequest;
6
 use App\Models\Customer;
7
 use App\Models\Customer;
7
 use App\Models\Product;
8
 use App\Models\Product;
8
 use App\Models\Sale;
9
 use App\Models\Sale;
9
-use Illuminate\Http\Request;
10
+use Illuminate\Database\QueryException;
11
+use Illuminate\Support\Facades\DB;
10
 use Inertia\Inertia;
12
 use Inertia\Inertia;
11
 
13
 
12
 class SalesController extends Controller
14
 class SalesController extends Controller
85
      */
87
      */
86
     public function store(StoreSaleRequest $request)
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
      */
128
      */
117
     public function edit(Sale $sale)
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
      * @param  Sale $sale
150
      * @param  Sale $sale
127
      * @return \Illuminate\Http\Response
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 View File

26
                 ->latest()
26
                 ->latest()
27
                 ->paginate(10)
27
                 ->paginate(10)
28
                 ->withQueryString()
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
      */
105
      */
105
     public function destroy(Supplier $supplier)
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 View File

29
             'price' => 'required|numeric',
29
             'price' => 'required|numeric',
30
             'qty' => 'required|numeric',
30
             'qty' => 'required|numeric',
31
             'customer_id' => 'required|numeric',
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 View File

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 View File

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

+ 1
- 1
app/Models/Price.php View File

11
 
11
 
12
     protected $fillable = [
12
     protected $fillable = [
13
         'price',
13
         'price',
14
-        'product_id',
14
+        'product_number',
15
         'customer_id',
15
         'customer_id',
16
         'supplier_id'
16
         'supplier_id'
17
     ];
17
     ];

+ 18
- 0
app/Models/Product.php View File

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
+use App\Models\PurchaseDetail;
6
+use App\Models\SaleDetail;
7
+use App\Models\StockProduct;
5
 use Illuminate\Database\Eloquent\Factories\HasFactory;
8
 use Illuminate\Database\Eloquent\Factories\HasFactory;
6
 use Illuminate\Database\Eloquent\Model;
9
 use Illuminate\Database\Eloquent\Model;
7
 
10
 
17
 
20
 
18
     protected $hidden = ['created_at', 'updated_at'];
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
     public function scopeFilter($query, array $filters)
38
     public function scopeFilter($query, array $filters)
21
     {
39
     {
22
         $query->when($filters['search'] ?? null, function ($query, $search) {
40
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 2
- 2
app/Models/PurchaseDetail.php View File

13
         'price',
13
         'price',
14
         'ppn',
14
         'ppn',
15
         'qty',
15
         'qty',
16
-        'purchase_id',
17
-        'product_id'
16
+        'purchase_number',
17
+        'product_number'
18
     ];
18
     ];
19
 }
19
 }

+ 9
- 4
app/Models/Sale.php View File

27
 
27
 
28
     public function saleDetail()
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
     public function product()
33
     public function product()
35
         return $this->hasOneThrough(
35
         return $this->hasOneThrough(
36
             Product::class,
36
             Product::class,
37
             SaleDetail::class,
37
             SaleDetail::class,
38
-            'sale_id',
38
+            'sale_number',
39
             'number',
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
     public function scopeFilter($query, array $filters)
50
     public function scopeFilter($query, array $filters)
46
     {
51
     {
47
         $query->when($filters['search'] ?? null, function ($query, $search) {
52
         $query->when($filters['search'] ?? null, function ($query, $search) {

+ 11
- 2
app/Models/SaleDetail.php View File

2
 
2
 
3
 namespace App\Models;
3
 namespace App\Models;
4
 
4
 
5
+use App\Services\HelperService;
6
+use Illuminate\Database\Eloquent\Casts\Attribute;
5
 use Illuminate\Database\Eloquent\Factories\HasFactory;
7
 use Illuminate\Database\Eloquent\Factories\HasFactory;
6
 use Illuminate\Database\Eloquent\Model;
8
 use Illuminate\Database\Eloquent\Model;
7
 
9
 
13
         'price',
15
         'price',
14
         'ppn',
16
         'ppn',
15
         'qty',
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 View File

13
         'purchase_number',
13
         'purchase_number',
14
         'sale_number',
14
         'sale_number',
15
         'amount',
15
         'amount',
16
-        'product_id'
16
+        'product_number'
17
     ];
17
     ];
18
 }
18
 }

+ 5
- 0
app/Models/Supplier.php View File

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

+ 15
- 0
app/Services/ProductService.php View File

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 View File

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

+ 2
- 1
database/migrations/2022_06_17_115154_create_sale_details_table.php View File

19
             $table->unsignedInteger('ppn');
19
             $table->unsignedInteger('ppn');
20
             $table->unsignedInteger('qty');
20
             $table->unsignedInteger('qty');
21
             $table->string('product_number');
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
             $table->foreign('product_number')->references('number')->on('products');
24
             $table->foreign('product_number')->references('number')->on('products');
24
             $table->timestamps();
25
             $table->timestamps();
25
         });
26
         });

+ 8
- 4
lang/en/messages.php View File

47
             'user' => 'User Account successfully changed',
47
             'user' => 'User Account successfully changed',
48
             'customer' => 'Customer successfully changed',
48
             'customer' => 'Customer successfully changed',
49
             'supplier' => 'Supplier successfully changed',
49
             'supplier' => 'Supplier successfully changed',
50
-            'product' => 'Product successfully changed'
50
+            'product' => 'Product successfully changed',
51
+            'sale' => 'Sale successfully changed'
51
         ],
52
         ],
52
         'destroy' => [
53
         'destroy' => [
53
             'type_member' => 'Jenis member successfully deleted',
54
             'type_member' => 'Jenis member successfully deleted',
56
             'member' => 'Member Account successfully deleted',
57
             'member' => 'Member Account successfully deleted',
57
             'user' => 'User Account successfully deleted',
58
             'user' => 'User Account successfully deleted',
58
             'customer' => 'Customer successfully deleted',
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
             'member' => 'member failed to be added',
69
             'member' => 'member failed to be added',
68
             'change_password' => 'Password invalid',
70
             'change_password' => 'Password invalid',
69
             'expense' => 'Expense failed to be added',
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
         'update' => [
75
         'update' => [
73
             'type_member' => 'Type member failed to be changed',
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 View File

47
             'user' => 'Akun user berhasil diubah',
47
             'user' => 'Akun user berhasil diubah',
48
             'customer' => 'Pelanggan berhasil diubah',
48
             'customer' => 'Pelanggan berhasil diubah',
49
             'supplier' => 'Supplier berhasil diubah',
49
             'supplier' => 'Supplier berhasil diubah',
50
-            'product' => 'Produk berhasil diubah'
50
+            'product' => 'Produk berhasil diubah',
51
+            'sale' => 'Penjualan berhasil diubah'
51
         ],
52
         ],
52
         'destroy' => [
53
         'destroy' => [
53
             'type_member' => 'Jenis member berhasil dihapus',
54
             'type_member' => 'Jenis member berhasil dihapus',
56
             'member' => 'Akun member berhasil dihapus',
57
             'member' => 'Akun member berhasil dihapus',
57
             'user' => 'Akun user berhasil dihapus',
58
             'user' => 'Akun user berhasil dihapus',
58
             'customer' => 'Pelanggan berhasil dihapus',
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
             'member' => 'Member gagal ditambahkan',
69
             'member' => 'Member gagal ditambahkan',
68
             'change_password' => 'Password lama salah',
70
             'change_password' => 'Password lama salah',
69
             'expense' => 'Pengeluaran gagal ditambahkan',
71
             'expense' => 'Pengeluaran gagal ditambahkan',
70
-            'transaction' => 'Transaksi gagal ditambahkan'
72
+            'transaction' => 'Transaksi gagal ditambahkan',
73
+            'sale' => 'Penjualan gagal ditambahkan'
71
         ],
74
         ],
72
         'update' => [
75
         'update' => [
73
             'type_member' => 'Jenis member gagal diubah',
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 View File

310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312
 /* harmony export */ });
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
     var expose = _ref.expose;
325
     var expose = _ref.expose;
330
     expose();
326
     expose();
331
     var props = __props;
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
       name: props.customer.name,
329
       name: props.customer.name,
334
       address: props.customer.address,
330
       address: props.customer.address,
335
       phone: props.customer.phone,
331
       phone: props.customer.phone,
336
       npwp: props.customer.npwp
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
     var onSubmit = function onSubmit() {
335
     var onSubmit = function onSubmit() {
356
       form.put(route('customers.update', props.customer.id));
336
       form.put(route('customers.update', props.customer.id));
359
     var __returned__ = {
339
     var __returned__ = {
360
       props: props,
340
       props: props,
361
       form: form,
341
       form: form,
362
-      deleteConfirm: deleteConfirm,
363
-      onDelete: onDelete,
364
       onSubmit: onSubmit,
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
347
     Object.defineProperty(__returned__, '__isScriptSetup', {
372
       enumerable: false,
348
       enumerable: false,
924
   "class": "grid"
900
   "class": "grid"
925
 };
901
 };
926
 var _hoisted_10 = {
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
 function render(_ctx, _cache, $props, $setup, $data, $options) {
905
 function render(_ctx, _cache, $props, $setup, $data, $options) {
933
-  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
934
-
935
   var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
906
   var _component_Button = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Button");
936
 
907
 
937
   var _component_Card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Card");
908
   var _component_Card = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Card");
940
     title: "Ubah Pelanggan"
911
     title: "Ubah Pelanggan"
941
   }, {
912
   }, {
942
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
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
         title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
915
         title: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
945
           return [_hoisted_3];
916
           return [_hoisted_3];
946
         }),
917
         }),
991
         }),
962
         }),
992
         footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
963
         footer: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
993
           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, {
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
             label: "Simpan",
965
             label: "Simpan",
1000
             icon: "pi pi-check",
966
             icon: "pi pi-check",
1001
             "class": "p-button-outlined",
967
             "class": "p-button-outlined",

+ 62
- 12
public/js/resources_js_pages_Customers_Index_vue.js View File

383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385
 /* harmony export */ });
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
   setup: function setup(__props, _ref) {
406
   setup: function setup(__props, _ref) {
403
     var expose = _ref.expose;
407
     var expose = _ref.expose;
404
     expose();
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
     var __returned__ = {
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413
       enumerable: false,
438
       enumerable: false,
1046
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047
 };
1072
 };
1048
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
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
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052
 
1081
 
1053
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
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
     title: "Daftar Pelanggan"
1085
     title: "Daftar Pelanggan"
1057
   }, {
1086
   }, {
1058
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1107
             _: 1
1136
             _: 1
1108
             /* STABLE */
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
         _: 1
1160
         _: 1
1123
     _: 1
1171
     _: 1
1124
     /* STABLE */
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 View File

310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312
 /* harmony export */ });
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
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
319
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
323
     var expose = _ref.expose;
325
     var expose = _ref.expose;
324
     expose();
326
     expose();
325
     var props = __props;
327
     var props = __props;
326
-    var form = useForm({
328
+    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm)({
327
       number: props.number,
329
       number: props.number,
328
       name: null,
330
       name: null,
329
       unit: null
331
       unit: null
341
       props: props,
343
       props: props,
342
       form: form,
344
       form: form,
343
       onSubmit: onSubmit,
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
350
     Object.defineProperty(__returned__, '__isScriptSetup', {
348
       enumerable: false,
351
       enumerable: false,
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
 /***/ "./resources/js/utils/menu.js":
997
 /***/ "./resources/js/utils/menu.js":
968
 /*!************************************!*\
998
 /*!************************************!*\
969
   !*** ./resources/js/utils/menu.js ***!
999
   !*** ./resources/js/utils/menu.js ***!

+ 35
- 5
public/js/resources_js_pages_Products_Edit_vue.js View File

310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
310
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
311
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
312
 /* harmony export */ });
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
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
319
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
323
     var expose = _ref.expose;
325
     var expose = _ref.expose;
324
     expose();
326
     expose();
325
     var props = __props;
327
     var props = __props;
326
-    var form = useForm({
328
+    var form = (0,_components_useForm__WEBPACK_IMPORTED_MODULE_0__.useForm)({
327
       number: props.product.number,
329
       number: props.product.number,
328
       name: props.product.name,
330
       name: props.product.name,
329
       unit: props.product.unit
331
       unit: props.product.unit
337
       props: props,
339
       props: props,
338
       form: form,
340
       form: form,
339
       onSubmit: onSubmit,
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
346
     Object.defineProperty(__returned__, '__isScriptSetup', {
344
       enumerable: false,
347
       enumerable: false,
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
 /***/ "./resources/js/utils/menu.js":
996
 /***/ "./resources/js/utils/menu.js":
967
 /*!************************************!*\
997
 /*!************************************!*\
968
   !*** ./resources/js/utils/menu.js ***!
998
   !*** ./resources/js/utils/menu.js ***!

+ 63
- 13
public/js/resources_js_pages_Products_Index_vue.js View File

383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385
 /* harmony export */ });
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
   setup: function setup(__props, _ref) {
406
   setup: function setup(__props, _ref) {
403
     var expose = _ref.expose;
407
     var expose = _ref.expose;
404
     expose();
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
     var __returned__ = {
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413
       enumerable: false,
438
       enumerable: false,
1046
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047
 };
1072
 };
1048
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
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
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052
 
1081
 
1053
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
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
     title: "Daftar Produk"
1085
     title: "Daftar Produk"
1057
   }, {
1086
   }, {
1058
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1100
                 href: _ctx.route('products.edit', data.id)
1129
                 href: _ctx.route('products.edit', data.id)
1101
               }, null, 8
1130
               }, null, 8
1102
               /* PROPS */
1131
               /* PROPS */
1103
-              , ["href"]), [[_directive_tooltip, 'Ubah Pelanggan', void 0, {
1132
+              , ["href"]), [[_directive_tooltip, 'Ubah Produk', void 0, {
1104
                 bottom: true
1133
                 bottom: true
1105
               }]])];
1134
               }]])];
1106
             }),
1135
             }),
1107
             _: 1
1136
             _: 1
1108
             /* STABLE */
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
         _: 1
1160
         _: 1
1123
     _: 1
1171
     _: 1
1124
     /* STABLE */
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 View File

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

+ 2637
- 0
public/js/resources_js_pages_Sales_Edit_vue.js
File diff suppressed because it is too large
View File


+ 12
- 2
public/js/resources_js_pages_Sales_Index_vue.js View File

1050
 
1050
 
1051
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
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
   return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1055
   return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)($setup["DashboardLayout"], {
1054
     title: "Daftar Penjualan"
1056
     title: "Daftar Penjualan"
1055
   }, {
1057
   }, {
1092
           )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1094
           )), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_Column, null, {
1093
             body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
1095
             body: (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function (_ref) {
1094
               var data = _ref.data;
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
             _: 1
1107
             _: 1
1098
             /* STABLE */
1108
             /* STABLE */
1135
   label: 'Pending',
1145
   label: 'Pending',
1136
   value: 'pending'
1146
   value: 'pending'
1137
 }, {
1147
 }, {
1138
-  label: 'Berhasil',
1148
+  label: 'Success',
1139
   value: 'success'
1149
   value: 'success'
1140
 }];
1150
 }];
1141
 var indexTable = [{
1151
 var indexTable = [{

+ 1
- 1
public/js/resources_js_pages_Sales_config_js.js View File

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

+ 62
- 12
public/js/resources_js_pages_Suppliers_Index_vue.js View File

383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
383
 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
384
 /* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
385
 /* harmony export */ });
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
   setup: function setup(__props, _ref) {
406
   setup: function setup(__props, _ref) {
403
     var expose = _ref.expose;
407
     var expose = _ref.expose;
404
     expose();
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
     var __returned__ = {
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
     Object.defineProperty(__returned__, '__isScriptSetup', {
437
     Object.defineProperty(__returned__, '__isScriptSetup', {
413
       enumerable: false,
438
       enumerable: false,
1046
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1071
   "class": "col-12 md:col-4 flex flex-column md:flex-row justify-content-end"
1047
 };
1072
 };
1048
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1073
 function render(_ctx, _cache, $props, $setup, $data, $options) {
1074
+  var _component_ConfirmDialog = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("ConfirmDialog");
1075
+
1049
   var _component_Column = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("Column");
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
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1080
   var _component_DataTable = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveComponent)("DataTable");
1052
 
1081
 
1053
   var _directive_tooltip = (0,vue__WEBPACK_IMPORTED_MODULE_0__.resolveDirective)("tooltip");
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
     title: "Daftar Supplier"
1085
     title: "Daftar Supplier"
1057
   }, {
1086
   }, {
1058
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1087
     "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
1107
             _: 1
1136
             _: 1
1108
             /* STABLE */
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
         _: 1
1160
         _: 1
1123
     _: 1
1171
     _: 1
1124
     /* STABLE */
1172
     /* STABLE */
1125
 
1173
 
1126
-  });
1174
+  })], 64
1175
+  /* STABLE_FRAGMENT */
1176
+  );
1127
 }
1177
 }
1128
 
1178
 
1129
 /***/ }),
1179
 /***/ }),

+ 9
- 1
public/js/vue.js View File

58623
 		"./resources/js/pages/Sales/Create.vue",
58623
 		"./resources/js/pages/Sales/Create.vue",
58624
 		"resources_js_pages_Sales_Create_vue"
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
 	"./Sales/Index": [
58634
 	"./Sales/Index": [
58627
 		"./resources/js/pages/Sales/Index.vue",
58635
 		"./resources/js/pages/Sales/Index.vue",
58628
 		"resources_js_pages_Sales_Index_vue"
58636
 		"resources_js_pages_Sales_Index_vue"
58836
 /******/ 		// This function allow to reference async chunks
58844
 /******/ 		// This function allow to reference async chunks
58837
 /******/ 		__webpack_require__.u = (chunkId) => {
58845
 /******/ 		__webpack_require__.u = (chunkId) => {
58838
 /******/ 			// return url for filenames based on template
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 View File

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

+ 1
- 33
resources/js/pages/Customers/Edit.vue View File

1
 <script setup>
1
 <script setup>
2
-import { Inertia } from '@inertiajs/inertia'
3
-import { useConfirm } from 'primevue/useconfirm'
4
 import { useForm } from '@/components/useForm'
2
 import { useForm } from '@/components/useForm'
5
 import AppInputText from '@/components/AppInputText.vue'
3
 import AppInputText from '@/components/AppInputText.vue'
6
 import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
4
 import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
16
   npwp: props.customer.npwp,
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
 const onSubmit = () => {
17
 const onSubmit = () => {
37
   form.put(route('customers.update', props.customer.id))
18
   form.put(route('customers.update', props.customer.id))
38
 }
19
 }
40
 
21
 
41
 <template>
22
 <template>
42
   <DashboardLayout title="Ubah Pelanggan">
23
   <DashboardLayout title="Ubah Pelanggan">
43
-    <ConfirmDialog />
44
-
45
     <div class="grid">
24
     <div class="grid">
46
       <div class="col-12 lg:col-8">
25
       <div class="col-12 lg:col-8">
47
         <Card>
26
         <Card>
91
           <template #footer>
70
           <template #footer>
92
             <div class="grid">
71
             <div class="grid">
93
               <div
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
                 <Button
75
                 <Button
108
                   label="Simpan"
76
                   label="Simpan"

+ 33
- 0
resources/js/pages/Customers/Index.vue View File

1
 <script setup>
1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2
 import { indexTable } from './config'
4
 import { indexTable } from './config'
3
 import AppSearch from '@/components/AppSearch.vue'
5
 import AppSearch from '@/components/AppSearch.vue'
4
 import AppButtonLink from '@/components/AppButtonLink.vue'
6
 import AppButtonLink from '@/components/AppButtonLink.vue'
9
   customers: Object,
11
   customers: Object,
10
   initialSearch: String,
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
 </script>
31
 </script>
13
 
32
 
14
 <template>
33
 <template>
34
+  <ConfirmDialog />
35
+
15
   <DashboardLayout title="Daftar Pelanggan">
36
   <DashboardLayout title="Daftar Pelanggan">
16
     <DataTable
37
     <DataTable
17
       responsiveLayout="scroll"
38
       responsiveLayout="scroll"
65
           />
86
           />
66
         </template>
87
         </template>
67
       </Column>
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
     </DataTable>
101
     </DataTable>
69
 
102
 
70
     <AppPagination :links="customers.links" />
103
     <AppPagination :links="customers.links" />

+ 2
- 0
resources/js/pages/Products/Create.vue View File

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

+ 1
- 0
resources/js/pages/Products/Edit.vue View File

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

+ 34
- 1
resources/js/pages/Products/Index.vue View File

1
 <script setup>
1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2
 import { indexTable } from './config'
4
 import { indexTable } from './config'
3
 import AppSearch from '@/components/AppSearch.vue'
5
 import AppSearch from '@/components/AppSearch.vue'
4
 import AppButtonLink from '@/components/AppButtonLink.vue'
6
 import AppButtonLink from '@/components/AppButtonLink.vue'
9
   products: Object,
11
   products: Object,
10
   initialSearch: String,
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
 </script>
31
 </script>
13
 
32
 
14
 <template>
33
 <template>
34
+  <ConfirmDialog />
35
+
15
   <DashboardLayout title="Daftar Produk">
36
   <DashboardLayout title="Daftar Produk">
16
     <DataTable
37
     <DataTable
17
       responsiveLayout="scroll"
38
       responsiveLayout="scroll"
60
           <AppButtonLink
81
           <AppButtonLink
61
             icon="pi pi-pencil"
82
             icon="pi pi-pencil"
62
             class="p-button-icon-only p-button-rounded p-button-text"
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
             :href="route('products.edit', data.id)"
85
             :href="route('products.edit', data.id)"
65
           />
86
           />
66
         </template>
87
         </template>
67
       </Column>
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
     </DataTable>
101
     </DataTable>
69
 
102
 
70
     <AppPagination :links="products.links" />
103
     <AppPagination :links="products.links" />

+ 2
- 2
resources/js/pages/Sales/Create.vue View File

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

+ 90
- 0
resources/js/pages/Sales/Edit.vue View File

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 View File

56
       />
56
       />
57
 
57
 
58
       <Column>
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
       </Column>
67
       </Column>
61
     </DataTable>
68
     </DataTable>
62
 
69
 

+ 1
- 1
resources/js/pages/Sales/config.js View File

4
     value: 'pending',
4
     value: 'pending',
5
   },
5
   },
6
   {
6
   {
7
-    label: 'Berhasil',
7
+    label: 'Success',
8
     value: 'success',
8
     value: 'success',
9
   },
9
   },
10
 ]
10
 ]

+ 33
- 0
resources/js/pages/Suppliers/Index.vue View File

1
 <script setup>
1
 <script setup>
2
+import { Inertia } from '@inertiajs/inertia'
3
+import { useConfirm } from 'primevue/useconfirm'
2
 import { indexTable } from './config'
4
 import { indexTable } from './config'
3
 import AppSearch from '@/components/AppSearch.vue'
5
 import AppSearch from '@/components/AppSearch.vue'
4
 import AppButtonLink from '@/components/AppButtonLink.vue'
6
 import AppButtonLink from '@/components/AppButtonLink.vue'
9
   suppliers: Object,
11
   suppliers: Object,
10
   initialSearch: String,
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
 </script>
31
 </script>
13
 
32
 
14
 <template>
33
 <template>
34
+  <ConfirmDialog />
35
+
15
   <DashboardLayout title="Daftar Supplier">
36
   <DashboardLayout title="Daftar Supplier">
16
     <DataTable
37
     <DataTable
17
       responsiveLayout="scroll"
38
       responsiveLayout="scroll"
65
           />
86
           />
66
         </template>
87
         </template>
67
       </Column>
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
     </DataTable>
101
     </DataTable>
69
 
102
 
70
     <AppPagination :links="suppliers.links" />
103
     <AppPagination :links="suppliers.links" />