Kaynağa Gözat

fix: settings master

Muhammad Iqbal Afandi 3 yıl önce
ebeveyn
işleme
60d2eef43b

+ 1
- 3
app/Http/Controllers/PpnController.php Dosyayı Görüntüle

15
      */
15
      */
16
     public function index()
16
     public function index()
17
     {
17
     {
18
-        $ppn = Ppn::first()->ppn;
19
-
20
-        return inertia("PPN/Index", compact("ppn"));
18
+        //
21
     }
19
     }
22
 
20
 
23
     /**
21
     /**

+ 87
- 0
app/Http/Controllers/SettingController.php Dosyayı Görüntüle

1
+<?php
2
+
3
+namespace App\Http\Controllers;
4
+
5
+use App\Models\Ppn;
6
+use Illuminate\Http\Request;
7
+
8
+class SettingController extends Controller
9
+{
10
+    /**
11
+     * Display a listing of the resource.
12
+     *
13
+     * @return \Illuminate\Http\Response
14
+     */
15
+    public function index()
16
+    {
17
+        return inertia("Settings/Index", [
18
+            "ppn" => Ppn::first()->ppn,
19
+        ]);
20
+    }
21
+
22
+    /**
23
+     * Show the form for creating a new resource.
24
+     *
25
+     * @return \Illuminate\Http\Response
26
+     */
27
+    public function create()
28
+    {
29
+        //
30
+    }
31
+
32
+    /**
33
+     * Store a newly created resource in storage.
34
+     *
35
+     * @param  \Illuminate\Http\Request  $request
36
+     * @return \Illuminate\Http\Response
37
+     */
38
+    public function store(Request $request)
39
+    {
40
+        //
41
+    }
42
+
43
+    /**
44
+     * Display the specified resource.
45
+     *
46
+     * @param  int  $id
47
+     * @return \Illuminate\Http\Response
48
+     */
49
+    public function show($id)
50
+    {
51
+        //
52
+    }
53
+
54
+    /**
55
+     * Show the form for editing the specified resource.
56
+     *
57
+     * @param  int  $id
58
+     * @return \Illuminate\Http\Response
59
+     */
60
+    public function edit($id)
61
+    {
62
+        //
63
+    }
64
+
65
+    /**
66
+     * Update the specified resource in storage.
67
+     *
68
+     * @param  \Illuminate\Http\Request  $request
69
+     * @param  int  $id
70
+     * @return \Illuminate\Http\Response
71
+     */
72
+    public function update(Request $request, $id)
73
+    {
74
+        //
75
+    }
76
+
77
+    /**
78
+     * Remove the specified resource from storage.
79
+     *
80
+     * @param  int  $id
81
+     * @return \Illuminate\Http\Response
82
+     */
83
+    public function destroy($id)
84
+    {
85
+        //
86
+    }
87
+}

+ 7
- 7
resources/js/layouts/Dashboard/menu.js Dosyayı Görüntüle

1
 export default {
1
 export default {
2
-  // Admin
2
+  // Owner
3
   1: [
3
   1: [
4
     {
4
     {
5
       label: 'Home',
5
       label: 'Home',
31
       label: 'Pengaturan',
31
       label: 'Pengaturan',
32
       items: [
32
       items: [
33
         {
33
         {
34
-          label: 'PPN',
35
-          icon: 'pi pi-percentage',
36
-          to: '/ppn',
37
-          component: 'PPN/Index',
34
+          label: 'Profil Perusahaan',
35
+          icon: 'pi pi-cog',
36
+          to: '/settings',
37
+          component: 'Settigs/Index',
38
         },
38
         },
39
       ],
39
       ],
40
     },
40
     },
41
   ],
41
   ],
42
 
42
 
43
-  // Supervisor
43
+  // Admin 1
44
   2: [
44
   2: [
45
     {
45
     {
46
       label: 'Home',
46
       label: 'Home',
78
     },
78
     },
79
   ],
79
   ],
80
 
80
 
81
-  // Operator
81
+  // Admin 2
82
   3: [
82
   3: [
83
     {
83
     {
84
       label: 'Home',
84
       label: 'Home',

+ 0
- 73
resources/js/pages/PPN/Index.vue Dosyayı Görüntüle

1
-<script setup>
2
-import { ref } from 'vue'
3
-import { useForm } from '@/composables/useForm'
4
-import AppInputText from '@/components/AppInputText.vue'
5
-import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
6
-
7
-const props = defineProps({
8
-  ppn: Number,
9
-})
10
-
11
-const form = useForm({
12
-  ppn: props.ppn,
13
-})
14
-
15
-const inputDisable = ref(true)
16
-
17
-const buttonLabel = ref('Ubah')
18
-
19
-const onSubmit = () => {
20
-  if (inputDisable.value) {
21
-    buttonLabel.value = 'Simpan'
22
-
23
-    inputDisable.value = false
24
-  } else {
25
-    if (!form.ppn) {
26
-      form.ppn = 0
27
-    }
28
-
29
-    buttonLabel.value = 'Ubah'
30
-
31
-    inputDisable.value = true
32
-
33
-    form.post(route('ppn.store'))
34
-  }
35
-}
36
-</script>
37
-
38
-<template>
39
-  <DashboardLayout title="Pengaturan PPN">
40
-    <div class="grid">
41
-      <div class="col-12 md:col-3">
42
-        <Card>
43
-          <template #content>
44
-            <div class="grid">
45
-              <div class="col-12">
46
-                <AppInputText
47
-                  label="PPN"
48
-                  placeholder="ppn"
49
-                  type="number"
50
-                  :disabled="inputDisable"
51
-                  :error="form.errors.ppn"
52
-                  v-model="form.ppn"
53
-                />
54
-              </div>
55
-
56
-              <div class="col-12">
57
-                <div class="flex flex-column md:flex-row justify-content-end">
58
-                  <Button
59
-                    icon="pi pi-check"
60
-                    class="p-button-outlined"
61
-                    :label="buttonLabel"
62
-                    :disabled="form.processing"
63
-                    @click="onSubmit"
64
-                  />
65
-                </div>
66
-              </div>
67
-            </div>
68
-          </template>
69
-        </Card>
70
-      </div>
71
-    </div>
72
-  </DashboardLayout>
73
-</template>

+ 27
- 0
resources/js/pages/Settings/Components/CompanyProfile.vue Dosyayı Görüntüle

1
+<script setup>
2
+import AppInputText from '@/components/AppInputText.vue'
3
+</script>
4
+
5
+<template>
6
+  <div class="grid">
7
+    <div class="col-12 md:col-6">
8
+      <AppInputText label="Nama" placeholder="nama" />
9
+    </div>
10
+    <div class="col-12 md:col-6">
11
+      <AppInputText label="Alamat" placeholder="alamat" />
12
+    </div>
13
+    <div class="col-12 md:col-6">
14
+      <AppInputText
15
+        type="number"
16
+        label="Nomor Telepon"
17
+        placeholder="nomor telepon"
18
+      />
19
+    </div>
20
+    <div class="col-12 md:col-6">
21
+      <AppInputText label="Email" placeholder="email" />
22
+    </div>
23
+    <div class="col-12 md:col-6">
24
+      <AppInputText type="number" label="NPWP" placeholder="npwp" />
25
+    </div>
26
+  </div>
27
+</template>

+ 61
- 0
resources/js/pages/Settings/Components/Ppn.vue Dosyayı Görüntüle

1
+<script setup>
2
+import { ref } from 'vue'
3
+import { useForm } from '@/composables/useForm'
4
+import AppInputText from '@/components/AppInputText.vue'
5
+import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
6
+
7
+const props = defineProps({
8
+  ppn: Number,
9
+})
10
+
11
+const form = useForm({
12
+  ppn: props.ppn,
13
+})
14
+
15
+const inputDisable = ref(true)
16
+
17
+const buttonLabel = ref('Ubah')
18
+
19
+const onSubmit = () => {
20
+  if (inputDisable.value) {
21
+    buttonLabel.value = 'Simpan'
22
+
23
+    inputDisable.value = false
24
+  } else {
25
+    if (!form.ppn) {
26
+      form.ppn = 0
27
+    }
28
+
29
+    buttonLabel.value = 'Ubah'
30
+
31
+    inputDisable.value = true
32
+
33
+    form.post(route('ppn.store'))
34
+  }
35
+}
36
+</script>
37
+
38
+<template>
39
+  <div class="grid">
40
+    <div class="col-12">
41
+      <AppInputText
42
+        label="PPN"
43
+        placeholder="ppn"
44
+        type="number"
45
+        :disabled="inputDisable"
46
+        :error="form.errors.ppn"
47
+        v-model="form.ppn"
48
+      />
49
+
50
+      <div class="flex flex-column md:flex-row justify-content-end">
51
+        <Button
52
+          icon="pi pi-check"
53
+          class="p-button-outlined"
54
+          :label="buttonLabel"
55
+          :disabled="form.processing"
56
+          @click="onSubmit"
57
+        />
58
+      </div>
59
+    </div>
60
+  </div>
61
+</template>

+ 28
- 0
resources/js/pages/Settings/Index.vue Dosyayı Görüntüle

1
+<script setup>
2
+import DashboardLayout from '@/layouts/Dashboard/DashboardLayout.vue'
3
+import Ppn from './Components/Ppn.vue'
4
+import CompanyProfile from './Components/CompanyProfile.vue'
5
+
6
+defineProps({
7
+  ppn: Number,
8
+})
9
+</script>
10
+
11
+<template>
12
+  <DashboardLayout title="Pengaturan">
13
+    <div class="grid">
14
+      <div class="col-12 md:col-8">
15
+        <Card>
16
+          <template #title> Pengaturan </template>
17
+          <template #content>
18
+            <CompanyProfile />
19
+
20
+            <divider />
21
+
22
+            <Ppn :ppn="ppn" />
23
+          </template>
24
+        </Card>
25
+      </div>
26
+    </div>
27
+  </DashboardLayout>
28
+</template>

+ 3
- 0
routes/web.php Dosyayı Görüntüle

6
 use App\Http\Controllers\ProductController;
6
 use App\Http\Controllers\ProductController;
7
 use App\Http\Controllers\PurchaseController;
7
 use App\Http\Controllers\PurchaseController;
8
 use App\Http\Controllers\SalesController;
8
 use App\Http\Controllers\SalesController;
9
+use App\Http\Controllers\SettingController;
9
 use App\Http\Controllers\StockProductController;
10
 use App\Http\Controllers\StockProductController;
10
 use App\Http\Controllers\SupplierController;
11
 use App\Http\Controllers\SupplierController;
11
 use App\Http\Controllers\UserController;
12
 use App\Http\Controllers\UserController;
46
 
47
 
47
     Route::resource("/ppn", PpnController::class);
48
     Route::resource("/ppn", PpnController::class);
48
 
49
 
50
+    Route::resource("/settings", SettingController::class);
51
+
49
     Route::resource("/customers", CustomerController::class);
52
     Route::resource("/customers", CustomerController::class);
50
 
53
 
51
     Route::resource("/purchases", PurchaseController::class);
54
     Route::resource("/purchases", PurchaseController::class);