Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ahmad Hasan Ali
Go-Toko
Commits
67956ef5
Commit
67956ef5
authored
1 year ago
by
Arif Rahman M
Browse files
Options
Download
Email Patches
Plain Diff
select multi toko
parent
20e40797
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
app/Http/Controllers/Auth/LoginController.php
+1
-1
app/Http/Controllers/Auth/LoginController.php
app/Http/Controllers/Owner/CompleteProfileController.php
+1
-47
app/Http/Controllers/Owner/CompleteProfileController.php
app/Http/Controllers/Owner/DashboardController.php
+27
-1
app/Http/Controllers/Owner/DashboardController.php
app/Http/Controllers/Owner/Products/ProductBrandController.php
+2
-2
...ttp/Controllers/Owner/Products/ProductBrandController.php
app/Http/Controllers/Owner/Products/ProductsCategoryController.php
+4
-4
...Controllers/Owner/Products/ProductsCategoryController.php
app/Http/Controllers/Owner/Settings/StoreController.php
+179
-0
app/Http/Controllers/Owner/Settings/StoreController.php
app/Http/Requests/Owner/CategoryValidate.php
+0
-2
app/Http/Requests/Owner/CategoryValidate.php
app/Http/Requests/Owner/CompleteProfileValidate.php
+0
-2
app/Http/Requests/Owner/CompleteProfileValidate.php
app/Http/Requests/Owner/StoreValidate.php
+44
-0
app/Http/Requests/Owner/StoreValidate.php
database/migrations/2023_05_16_143659_create_shop_models_table.php
+0
-2
...migrations/2023_05_16_143659_create_shop_models_table.php
database/seeders/menuSeeder.php
+10
-4
database/seeders/menuSeeder.php
resources/views/page/owner/fill-profile/form/business.blade.php
+0
-26
...ces/views/page/owner/fill-profile/form/business.blade.php
resources/views/page/owner/index.blade.php
+43
-7
resources/views/page/owner/index.blade.php
resources/views/page/owner/products-category/index.blade.php
+21
-3
resources/views/page/owner/products-category/index.blade.php
resources/views/page/owner/settings/store/add-edit.blade.php
+247
-0
resources/views/page/owner/settings/store/add-edit.blade.php
resources/views/page/owner/settings/store/index.blade.php
+221
-0
resources/views/page/owner/settings/store/index.blade.php
routes/owner.php
+15
-1
routes/owner.php
with
815 additions
and
102 deletions
+815
-102
app/Http/Controllers/Auth/LoginController.php
View file @
67956ef5
...
...
@@ -73,7 +73,7 @@ public function handleGoogleCallback(Request $request)
Auth
::
login
(
$newUser
);
return
redirect
()
->
intended
(
route
(
'owner.complete-profile'
));
return
redirect
()
->
intended
(
route
(
'owner.complete-profile
.index
'
));
}
catch
(
Exception
$th
)
{
DB
::
rollBack
();
Log
::
error
(
"Error when store data to databases in user registration with socialite, the error is: "
.
$th
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Owner/CompleteProfileController.php
View file @
67956ef5
...
...
@@ -61,49 +61,6 @@ public function getVillage(Request $request)
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public
function
create
()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public
function
store
(
Request
$request
)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
show
(
$id
)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
edit
(
$id
)
{
//
}
/**
* Update the specified resource in storage.
*
...
...
@@ -135,9 +92,7 @@ public function update(CompleteProfileValidate $request, $idEncrypt)
ShopModel
::
create
([
'name'
=>
$request
->
nameBusiness
,
'description'
=>
$request
->
descriptionBusiness
,
'email'
=>
$request
->
emailBusiness
,
'user_id'
=>
$userProfile
->
user_id
,
'contact'
=>
$request
->
contactBusiness
,
'province'
=>
$provinceName
,
'regency'
=>
$regencyName
,
'district'
=>
$districtName
,
...
...
@@ -149,7 +104,6 @@ public function update(CompleteProfileValidate $request, $idEncrypt)
}
catch
(
\
Throwable
$th
)
{
//throw $th;
DB
::
rollBack
();
dd
(
$th
);
return
back
();
}
return
redirect
(
route
(
'owner.dashboard'
))
->
with
(
'success'
,
'Success complete your profile'
);
...
...
@@ -165,4 +119,4 @@ public function destroy($id)
{
//
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Owner/DashboardController.php
View file @
67956ef5
...
...
@@ -3,13 +3,39 @@
namespace
App\Http\Controllers\Owner
;
use
App\Http\Controllers\Controller
;
use
App\Models\ShopModel
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Crypt
;
use
Illuminate\Support\Facades\Session
;
class
DashboardController
extends
Controller
{
//
public
function
index
()
{
return
view
(
'page.owner.index'
);
$userId
=
Auth
::
user
()
->
id
;
$shops
=
ShopModel
::
where
([[
'user_id'
,
$userId
],
[
'isActive'
,
true
]])
->
orderBy
(
'created_at'
,
'desc'
);
if
(
Session
::
has
(
'active'
))
{
$id
=
Crypt
::
decrypt
(
Session
::
get
(
'active'
));
return
view
(
'page.owner.index'
,
[
'shop'
=>
$shops
->
where
([
'id'
=>
$id
])
->
first
()
]);
}
return
view
(
'page.owner.index'
,
[
'shops'
=>
$shops
->
get
()
]);
}
public
function
setSession
(
$id
)
{
Session
::
put
(
'active'
,
$id
);
return
redirect
(
route
(
'owner.dashboard'
));
}
public
function
deleteSession
()
{
Session
::
forget
(
'active'
);
return
redirect
(
route
(
'owner.dashboard'
));
}
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Owner/Products/ProductBrandController.php
View file @
67956ef5
...
...
@@ -116,9 +116,9 @@ public function update(BrandValidate $request, $id)
'image'
=>
$filename
,
]);
}
catch
(
\
Throwable
$th
)
{
return
back
();
return
back
()
->
with
([
'type'
=>
'error'
,
'error'
=>
'Something wrong'
])
;
}
return
redirect
(
route
(
'owner.products.brand.index'
));
return
redirect
(
route
(
'owner.products.brand.index'
))
->
with
([
'type'
=>
'success'
,
'success'
=>
'Success change brand'
])
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Owner/Products/ProductsCategoryController.php
View file @
67956ef5
...
...
@@ -55,9 +55,9 @@ public function store(CategoryValidate $request)
'images'
=>
$filename
,
]);
}
catch
(
\
Throwable
$th
)
{
return
back
();
return
back
()
->
with
([
'type'
=>
'error'
,
'error'
=>
'Something wrong'
])
;
}
return
redirect
(
route
(
'owner.products.category.index'
))
->
with
(
'success'
,
"Success saving data ✅"
);
return
redirect
(
route
(
'owner.products.category.index'
))
->
with
(
[
'success'
=>
"Success saving data ✅"
,
'type'
=>
'success'
]
);
}
/**
...
...
@@ -116,9 +116,9 @@ public function update(CategoryValidate $request, $id)
'image'
=>
$filename
,
]);
}
catch
(
\
Throwable
$th
)
{
return
back
()
->
with
(
'error'
,
'Error when submit to system'
);
return
back
()
->
with
(
[
'error'
=>
'Error when submit to system'
],
[
'type'
=>
'error'
]
);
}
return
redirect
(
route
(
'owner.products.category.index'
))
->
with
(
'success'
,
'Success saving data 😎'
);
return
redirect
(
route
(
'owner.products.category.index'
))
->
with
(
[
'success'
=>
'Success saving data 😎'
,
'type'
=>
'success'
]
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Owner/Settings/StoreController.php
0 → 100644
View file @
67956ef5
<?php
namespace
App\Http\Controllers\Owner\Settings
;
use
App\Http\Controllers\Controller
;
use
App\Http\Requests\Owner\StoreValidate
;
use
App\Models\District
;
use
App\Models\Province
;
use
App\Models\Regency
;
use
App\Models\ShopModel
;
use
App\Models\Village
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Crypt
;
class
StoreController
extends
Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public
function
index
()
{
$userId
=
Auth
::
user
()
->
id
;
$deletedStore
=
ShopModel
::
where
([
[
'user_id'
,
$userId
],
[
'isActive'
,
false
]
])
->
get
();
$storeUser
=
ShopModel
::
where
([
[
'user_id'
,
$userId
],
[
'isActive'
,
true
]
])
->
get
();
return
view
(
'page.owner.settings.store.index'
,
[
'stores'
=>
$storeUser
,
'deletedStores'
=>
$deletedStore
]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public
function
create
()
{
$provinces
=
Province
::
all
();
return
view
(
'page.owner.settings.store.add-edit'
,
[
'provinces'
=>
$provinces
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public
function
store
(
StoreValidate
$request
)
{
$request
[
'province'
]
=
Province
::
where
(
'id'
,
$request
->
province
)
->
first
()
->
name
;
$request
[
'regency'
]
=
Regency
::
where
(
'id'
,
$request
->
regency
)
->
first
()
->
name
;
$request
[
'district'
]
=
District
::
where
(
'id'
,
$request
->
district
)
->
first
()
->
name
;
$request
[
'village'
]
=
Village
::
where
(
'id'
,
$request
->
village
)
->
first
()
->
name
;
$request
[
'user_id'
]
=
Auth
::
user
()
->
id
;
// dd($request);
try
{
ShopModel
::
create
([
'name'
=>
$request
->
name
,
'description'
=>
$request
->
description
,
'user_id'
=>
$request
->
user_id
,
'province'
=>
$request
->
province
,
'regency'
=>
$request
->
regency
,
'district'
=>
$request
->
district
,
'village'
=>
$request
->
village
,
'address'
=>
$request
->
address
,
]);
// ShopModel::create([
// 'name' =>
// ]);
}
catch
(
\
Throwable
$e
)
{
# code...
return
back
()
->
with
(
'error'
,
'Something wrong'
);
}
return
redirect
(
route
(
'owner.settings.store.index'
))
->
with
([
'success'
=>
'Success make new store'
,
'type'
=>
'success'
]);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
show
(
$id
)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
edit
(
$id
)
{
$id
=
Crypt
::
decrypt
(
$id
);
$data
=
ShopModel
::
where
([
'id'
=>
$id
])
->
first
();
$provinces
=
Province
::
all
();
return
view
(
'page.owner.settings.store.add-edit'
,
[
'data'
=>
$data
,
'provinces'
=>
$provinces
]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
update
(
StoreValidate
$request
,
$id
)
{
$id
=
Crypt
::
decrypt
(
$id
);
$dataStore
=
ShopModel
::
findOrFail
(
$id
);
if
(
$request
->
province
||
$request
->
regency
||
$request
->
district
||
$request
->
village
)
{
$request
->
validate
([
'province'
=>
'required'
,
'regency'
=>
'required'
,
'district'
=>
'required'
,
'village'
=>
'required'
,
]);
// dd($request->province, $request->regency, $request->district, $request->village, $request);
}
$request
[
'province'
]
=
(
Province
::
where
([
'id'
=>
$request
->
province
])
->
first
()
->
name
)
??
$dataStore
->
province
;
$request
[
'regency'
]
=
(
Regency
::
where
([
'id'
=>
$request
->
regency
])
->
first
()
->
name
)
??
$dataStore
->
regency
;
$request
[
'district'
]
=
(
District
::
where
([
'id'
=>
$request
->
district
])
->
first
()
->
name
)
??
$dataStore
->
district
;
$request
[
'village'
]
=
(
Village
::
where
([
'id'
=>
$request
->
village
])
->
first
()
->
name
)
??
$dataStore
->
village
;
// dd($request);
try
{
$dataStore
->
update
([
'name'
=>
$request
->
name
,
'description'
=>
$request
->
description
,
'province'
=>
$request
->
province
,
'regency'
=>
$request
->
regency
,
'district'
=>
$request
->
district
,
'village'
=>
$request
->
village
,
'address'
=>
$request
->
address
,
]);
}
catch
(
\
Throwable
$e
)
{
return
back
()
->
with
([
'type'
=>
'error'
,
'error'
=>
'Something wrong'
]);
}
return
redirect
(
route
(
'owner.settings.store.index'
))
->
with
([
'type'
=>
'success'
,
'success'
=>
'Successfully changed data'
]);
// dd($request, $id, $dataStore, gettype($request->province));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
$id
)
{
$id
=
Crypt
::
decrypt
(
$id
);
$store
=
ShopModel
::
findOrFail
(
$id
);
try
{
$store
->
update
([
'isActive'
=>
false
]);
}
catch
(
\
Throwable
$e
)
{
return
response
()
->
json
([
'status'
=>
'error'
]);
}
return
response
()
->
json
([
'status'
=>
'success'
]);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
app/Http/Requests/Owner/CategoryValidate.php
View file @
67956ef5
...
...
@@ -2,8 +2,6 @@
namespace
App\Http\Requests\Owner
;
use
App\Constants\RequestRuleConstant
;
use
Google\Service\ServiceControl\Request
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Support\Facades\Crypt
;
use
Illuminate\Support\Facades\Route
;
...
...
This diff is collapsed.
Click to expand it.
app/Http/Requests/Owner/CompleteProfileValidate.php
View file @
67956ef5
...
...
@@ -33,8 +33,6 @@ public function rules()
'address'
=>
''
,
'nameBusiness'
=>
'required'
,
'emailBusiness'
=>
'required|email:dns'
,
'contactBusiness'
=>
'required|numeric|min_digits:8'
,
'provinceBusiness'
=>
'required'
,
'regencyBusiness'
=>
'required'
,
'districtBusiness'
=>
'required'
,
...
...
This diff is collapsed.
Click to expand it.
app/Http/Requests/Owner/StoreValidate.php
0 → 100644
View file @
67956ef5
<?php
namespace
App\Http\Requests\Owner
;
use
Illuminate\Foundation\Http\FormRequest
;
use
Illuminate\Support\Facades\Route
;
class
StoreValidate
extends
FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public
function
authorize
()
{
return
true
;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public
function
rules
()
{
if
(
Route
::
is
(
'owner.settings.store.store'
))
{
return
[
'name'
=>
'required'
,
'description'
=>
'required'
,
'province'
=>
'required'
,
'regency'
=>
'required'
,
'district'
=>
'required'
,
'village'
=>
'required'
,
];
}
else
if
(
Route
::
is
(
'owner.settings.store.update'
))
{
return
[
'name'
=>
'required'
,
'description'
=>
'required'
,
];
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
database/migrations/2023_05_16_143659_create_shop_models_table.php
View file @
67956ef5
...
...
@@ -18,8 +18,6 @@ public function up()
$table
->
string
(
'name'
);
$table
->
string
(
'description'
);
$table
->
unsignedBigInteger
(
'user_id'
);
$table
->
string
(
'email'
);
$table
->
string
(
'contact'
);
$table
->
string
(
'province'
);
$table
->
string
(
'regency'
);
$table
->
string
(
'district'
);
...
...
This diff is collapsed.
Click to expand it.
database/seeders/menuSeeder.php
View file @
67956ef5
...
...
@@ -183,7 +183,7 @@ public function run()
'url'
=>
'owner/purchases/order'
,
'status'
=>
1
]);
//submenu report
SubMenuModel
::
create
([
'menu_id'
=>
$owreport
->
id
,
...
...
@@ -197,7 +197,7 @@ public function run()
'url'
=>
'owner/report/inventory'
,
'status'
=>
1
]);
//submenu Settings
SubMenuModel
::
create
([
'menu_id'
=>
$owsettings
->
id
,
...
...
@@ -205,6 +205,12 @@ public function run()
'url'
=>
'owner/settings/profile'
,
'status'
=>
1
]);
SubMenuModel
::
create
([
'menu_id'
=>
$owsettings
->
id
,
'name'
=>
'My Store'
,
'url'
=>
'owner/settings/store'
,
'status'
=>
1
]);
//RoleMenu Table
//Superadmin
...
...
@@ -233,7 +239,7 @@ public function run()
]);
//Owner
RoleMenuModel
::
create
([
'role_id'
=>
2
,
'menu_id'
=>
$owdashboard
->
id
,
...
...
@@ -265,4 +271,4 @@ public function run()
'subscribe'
=>
0
,
]);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
resources/views/page/owner/fill-profile/form/business.blade.php
View file @
67956ef5
...
...
@@ -30,32 +30,6 @@ class="form-control @error('descriptionBusiness') is-invalid @enderror" autofocu
@enderror
</div>
</div>
<div
class=
"col-lg-4 col-md-6"
>
<div
class=
"mb-3"
>
<label
for=
"emailBusiness"
class=
"form-label"
>
Email
</label>
<input
type=
"text"
name=
"emailBusiness"
id=
"emailBusiness"
class=
"form-control @error('emailBusiness') is-invalid @enderror"
required
value=
"{{ old('emailBusiness') }}"
>
@error('emailBusiness')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-4 col-md-6"
>
<div
class=
"mb-3"
>
<label
for=
"contactBusiness"
class=
"form-label"
>
Contact
</label>
<input
type=
"text"
name=
"contactBusiness"
id=
"contactBusiness"
class=
"form-control @error('contactBusiness') is-invalid @enderror"
required
value=
"{{ old('contactBusiness') }}"
>
@error('contactBusiness')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-4 col-md-6"
>
<div
class=
"mb-3"
>
<label
for=
"provinceBusiness"
class=
"form-label"
>
Province
</label>
...
...
This diff is collapsed.
Click to expand it.
resources/views/page/owner/index.blade.php
View file @
67956ef5
...
...
@@ -21,19 +21,55 @@
<li
class=
"breadcrumb-item active"
>
@yield('title')
</li>
</ul>
</h6>
@if (Session::has('active'))
<a
href=
"{{ route('owner.deleteSession') }}"
class=
"btn btn-secondary mt-2"
>
Back to select the store you want to manage
</a>
@endif
</div>
</div>
@dump(Session::all())
{{-- Body Start --}}
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<section
class=
"comp-section"
>
<div
class=
"card-body"
>
@if (Session::has('active'))
<div
class=
"row"
>
<div
class=
"col-12"
>
<section
class=
"comp-section"
>
<div
class=
"row d-flex"
>
<h4>
{{ $shop->name }}
</h4>
</div>
</section>
</div>
</div>
@else
<div
class=
"row"
>
<div
class=
"col-12"
>
<section
class=
"comp-section"
>
<div
class=
"row d-flex"
>
@foreach ($shops as $shop)
<div
class=
"col-sm-12 col-md-6 col-lg-4"
>
<div
class=
"card flex-fill bg-white"
>
<div
class=
"card-header d-flex justify-content-between"
>
<h5
class=
"card-title mb-0"
>
{{ $shop->name }}
</h5>
<div
class=
"status-toggle d-flex justify-content-between align-items-center"
>
<input
type=
"checkbox"
id=
"user3"
class=
"check"
checked=
""
>
<label
for=
"user3"
class=
"checktoggle"
>
checkbox
</label>
</div>
</div>
<div
class=
"card-body"
>
<p
class=
"card-text"
>
{{ $shop->description }}
</p>
<a
class=
"btn btn-primary"
href=
"{{ route('owner.setSession', Crypt::encrypt($shop->id)) }}"
>
Manage
</a>
</div>
</div>
</div>
@endforeach
</div>
</section>
</div>
</section>
</div>
</div>
</div>
@endif
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
resources/views/page/owner/products-category/index.blade.php
View file @
67956ef5
...
...
@@ -97,6 +97,12 @@
</div>
@endsection
<?php
$title
=
e
(
$__env
->
yieldContent
(
'title'
));
$type
=
Session
::
get
(
'type'
);
$msg
=
Session
::
get
(
$type
);
// dd($type);
?>
@section('forscript')
{{-- Toast import js --}}
...
...
@@ -104,15 +110,27 @@
<script
src=
"{{ URL::asset('/assets/plugins/toastr/toastr.js') }}"
></script>
<script>
@
if
(
Session
::
has
(
'
success
'
))
let
type
=
{
!!
json_encode
(
$type
)
!!
};
let
msg
=
{
!!
json_encode
(
$msg
)
!!
};
const
title
=
{
!!
json_encode
(
$title
)
!!
};
@
if
(
Session
::
has
(
$type
))
{
toastr
.
success
(
"
{!! Session::get('success') !!}
"
,
"
Category
"
,
{
toastr
[
type
](
msg
,
title
,
{
closeButton
:
!
0
,
tapToDismiss
:
!
1
,
positionClass
:
'
toast-top-center
'
,
})
;
})
}
@
endif
// @if (Session::has('success'))
// {
// toastr.success("{!! Session::get('success') !!}", "Category", {
// closeButton: !0,
// tapToDismiss: !1,
// positionClass: 'toast-top-center',
// });
// }
// @endif
</script>
<script>
$
(
document
).
on
(
'
click
'
,
'
#confirm-delete
'
,
function
(
event
)
{
...
...
This diff is collapsed.
Click to expand it.
resources/views/page/owner/settings/store/add-edit.blade.php
0 → 100644
View file @
67956ef5
<?php
$page
=
'menus'
;
?>
@extends('layout.mainlayout')
@section('title', isset($data) ? 'Edit Store' : 'Add Store')
@section('forhead')
{{-- Toastr Style --}}
<link
rel=
"stylesheet"
href=
"{{ url('assets/plugins/toastr/toatr.css') }}"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
@endsection
@section('content')
<div
class=
"page-wrapper pagehead"
>
<div
class=
"content"
>
<div
class=
"page-header"
>
<div
class=
"page-title"
>
<h4>
@yield('title')
</h4>
<h6>
<ul
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
><a
href=
"{{ url('owner/dashboard') }}"
>
Dashboard
</a></li>
<li
class=
"breadcrumb-item"
><a
href=
"{{ url('owner/settings/store') }}"
>
Store
</a></li>
<li
class=
"breadcrumb-item active"
>
@yield('title')
</li>
</ul>
</h6>
</div>
</div>
{{-- Body Start --}}
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<section
class=
"comp-section"
>
<div
class=
"card-body"
>
<form
action=
"{{ isset($data) ? route('owner.settings.store.update', Crypt::encrypt($data->id)) : route('owner.settings.store.store') }}"
method=
"post"
>
@csrf
@if (isset($data))
{{ method_field('put') }}
@endif
<div
class=
"row"
>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store Name
</label>
<input
id=
"name"
name=
"name"
type=
"text"
class=
"form-control @error('name') is-invalid @enderror"
value=
"{{ old('name') ?? ($data->name ?? null) }}"
autofocus
required
>
@error('name')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store Description
</label>
<input
id=
"description"
name=
"description"
type=
"text"
class=
"form-control @error('description')
is-invalid
@enderror"
value=
"{{ old('description') ?? ($data->description ?? null) }}"
required
>
@error('description')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store Province
</label>
<select
name=
"province"
id=
"province"
class=
"select @error('province') is-invalid @enderror"
>
<option
value=
"null"
selected
disabled
>
-- Select --
</option>
@foreach ($provinces as $province)
<option
value=
"{{ $province->id }}"
{{
old
('
province
'
) =
==
$
province-
>
id ? 'selected' : '' }}>
{{ $province->name }}
</option>
@endforeach
</select>
@error('province')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store Regency
</label>
<select
name=
"regency"
id=
"regency"
class=
"select @error('regency') is-invalid @enderror"
>
<option
value=
"null"
selected
disabled
>
-- Select --
</option>
</select>
@error('regency')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store District
</label>
<select
name=
"district"
id=
"district"
class=
"select @error('district') is-invalid @enderror"
>
<option
value=
"null"
selected
disabled
>
-- Select --
</option>
</select>
@error('district')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-3 col-sm-6 col-12"
>
<div
class=
"form-group"
>
<label>
Store Village
</label>
<select
name=
"village"
id=
"village"
class=
"select @error('village') is-invalid @enderror"
>
<option
value=
"null"
selected
disabled
>
-- Select --
</option>
</select>
@error('village')
<div
class=
"invalid-feedback"
>
{{ $message }}
</div>
@enderror
</div>
</div>
<div
class=
"col-lg-12"
>
<div
class=
"form-group"
>
<label>
Address
<span
class=
"text-muted"
>
(optional)
</span></label>
<textarea
id=
"address"
name=
"address"
class=
"form-control"
>
{{ old('address') ?? ($data->address ?? null) }}
</textarea>
</div>
</div>
<div
class=
"col-lg-12"
>
<button
type=
"submit"
class=
"btn btn-submit me-2"
>
Submit
</button>
<a
href=
"{{ URL::previous() }}"
class=
"btn btn-cancel"
>
Cancel
</a>
</div>
</div>
</form>
</div>
</section>
</div>
</div>
</div>
</div>
@endsection
<?php
$title
=
e
(
$__env
->
yieldContent
(
'title'
));
$type
=
Session
::
get
(
'type'
);
$msg
=
Session
::
get
(
$type
);
// dd($type);
?>
@section('forscript')
{{-- Toast import js --}}
<script
src=
"{{ URL::asset('/assets/plugins/toastr/toastr.min.js') }}"
></script>
<script
src=
"{{ URL::asset('/assets/plugins/toastr/toastr.js') }}"
></script>
<script>
$
(
function
()
{
$
.
ajaxSetup
({
headers
:
{
'
X-CSRF-TOKEN
'
:
$
(
'
meta[name="csrf-token"]
'
).
attr
(
'
content
'
)
}
})
})
// get and display kabupaten
$
(
function
()
{
$
(
'
#province
'
).
on
(
'
change
'
,
function
()
{
let
idProvince
=
$
(
'
#province
'
).
val
();
$
.
ajax
({
type
:
'
POST
'
,
url
:
'
{{ route(
'
owner
.
complete
-
profile
.
getRegencies
'
) }}
'
,
data
:
{
id_province
:
idProvince
},
cache
:
false
,
success
:
function
(
regency
)
{
$
(
'
#regency
'
).
html
(
regency
)
},
})
})
})
// get and display kecamatan
$
(
function
()
{
$
(
'
#regency
'
).
on
(
'
change
'
,
function
()
{
let
idRegency
=
$
(
'
#regency
'
).
val
();
$
.
ajax
({
type
:
'
POST
'
,
url
:
'
{{ route(
'
owner
.
complete
-
profile
.
getDistrict
'
) }}
'
,
data
:
{
id_regency
:
idRegency
},
cache
:
false
,
success
:
function
(
district
)
{
$
(
'
#district
'
).
html
(
district
)
},
})
})
})
// get and display desa
$
(
function
()
{
$
(
'
#district
'
).
on
(
'
change
'
,
function
()
{
let
idDistrict
=
$
(
'
#district
'
).
val
();
$
.
ajax
({
type
:
'
POST
'
,
url
:
'
{{ route(
'
owner
.
complete
-
profile
.
getVillage
'
) }}
'
,
data
:
{
id_district
:
idDistrict
},
cache
:
false
,
success
:
function
(
villages
)
{
$
(
'
#village
'
).
html
(
villages
)
}
})
})
})
</script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
'
.select
'
).
select2
({
tags
:
true
})
})
let
type
=
{
!!
json_encode
(
$type
)
!!
};
let
msg
=
{
!!
json_encode
(
$msg
)
!!
};
const
title
=
{
!!
json_encode
(
$title
)
!!
};
@
if
(
Session
::
has
(
$type
))
{
toastr
[
type
](
msg
,
title
,
{
closeButton
:
!
0
,
tapToDismiss
:
!
1
,
positionClass
:
'
toast-top-center
'
,
})
}
@
endif
</script>
@endsection
This diff is collapsed.
Click to expand it.
resources/views/page/owner/settings/store/index.blade.php
0 → 100644
View file @
67956ef5
<?php
$page
=
'menus'
;
?>
@extends('layout.mainlayout')
@section('title', 'My Store')
@section('forhead')
{{-- Toastr Style --}}
<link
rel=
"stylesheet"
href=
"{{ url('assets/plugins/toastr/toatr.css') }}"
>
<meta
name=
"csrf-token"
content=
"{{ csrf_token() }}"
>
@endsection
@section('content')
<div
class=
"page-wrapper pagehead"
>
<div
class=
"content"
>
<div
class=
"page-header"
>
<div
class=
"page-title"
>
<h4>
@yield('title')
</h4>
<h6>
<ul
class=
"breadcrumb"
>
<li
class=
"breadcrumb-item"
><a
href=
"{{ url('owner/dashboard') }}"
>
Dashboard
</a></li>
<li
class=
"breadcrumb-item active"
>
@yield('title')
</li>
</ul>
</h6>
</div>
<div
class=
"page-btn"
>
<a
href=
"{{ route('owner.settings.store.add') }}"
class=
"btn btn-added"
>
<img
src=
"{{ URL::asset('assets/img/icons/plus.svg') }}"
class=
"me-1"
alt=
"img"
>
Add Store
</a>
</div>
</div>
{{-- Body Start --}}
<div
class=
"row"
>
<div
class=
"col-sm-12 my-5"
>
<section
class=
"comp-section"
>
<div
class=
"table-responsive"
>
<table
class=
"table datanew"
>
<thead>
<tr>
<th
class=
"col-0"
>
<label
class=
"checkboxs"
>
<input
type=
"checkbox"
id=
"select-all"
/>
<span
class=
"checkmarks"
></span>
</label>
</th>
<th
class=
"col-2"
>
Name
</th>
<th
class=
"col-2"
>
Description
</th>
<th
class=
"col-5"
>
Address
</th>
<th
class=
"col-2"
>
Status
</th>
<th
class=
"col-1"
>
Action
</th>
</tr>
</thead>
<tbody>
@foreach ($stores as $store)
<tr>
<td>
<label
class=
"checkboxs"
>
<input
type=
"checkbox"
/>
<span
class=
"checkmarks"
></span>
</label>
</td>
<td>
{{ $store->name }}
</td>
<td>
{{ $store->description }}
</td>
<td>
{{ $store?->address ? $store->address . ', ' . $store->village . ', ' . $store->district . ', ' . $store->regency . ', ' . $store->province : $store->village . ', ' . $store->district . ', ' . $store->regency . ', ' . $store->province }}
</td>
<td>
{{ $store->isActive }}
</td>
<td>
<a
class=
"me-3"
href=
"{{ route('owner.settings.store.edit', ['id' => Crypt::encrypt($store->id)]) }}"
>
<img
src=
"{{ URL::asset('assets/img/icons/edit.svg') }}"
alt=
"img"
/>
</a>
<a
class=
"me-3"
id=
"confirm-delete"
data-action=
"{{ route('owner.settings.store.delete', ['id' => Crypt::encrypt($store->id)]) }}"
>
<img
src=
"{{ URL::asset('assets/img/icons/delete.svg') }}"
alt=
"img"
/>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</section>
</div>
@if ($deletedStores)
<div
class=
"col-sm-12"
>
<div>
<h3
class=
"text-center"
>
Deleted Store
</h3>
</div>
<section
class=
"comp-section"
>
<div
class=
"table-responsive"
>
<table
class=
"table datanew"
>
<thead>
<tr>
<th
class=
"col-0"
>
<label
class=
"checkboxs"
>
<input
type=
"checkbox"
id=
"select-all"
/>
<span
class=
"checkmarks"
></span>
</label>
</th>
<th
class=
"col-2"
>
Name
</th>
<th
class=
"col-2"
>
Description
</th>
<th
class=
"col-5"
>
Address
</th>
<th
class=
"col-2"
>
Status
</th>
<th
class=
"col-1"
>
Action
</th>
</tr>
</thead>
<tbody>
@foreach ($deletedStores as $store)
@dump()
<tr>
<td>
<label
class=
"checkboxs"
>
<input
type=
"checkbox"
/>
<span
class=
"checkmarks"
></span>
</label>
</td>
<td>
{{ $store->name }}
</td>
<td>
{{ $store->description }}
</td>
<td>
{{ $store?->address ? $store->address . ', ' . $store->village . ', ' . $store->district . ', ' . $store->regency . ', ' . $store->province : $store->village . ', ' . $store->district . ', ' . $store->regency . ', ' . $store->province }}
</td>
<td>
{{ $store->isActive }}
</td>
<td>
<a
class=
"me-3"
href=
"{{ route('owner.settings.store.edit', ['id' => Crypt::encrypt($store->id)]) }}"
>
<img
src=
"{{ URL::asset('assets/img/icons/edit.svg') }}"
alt=
"img"
/>
</a>
<a
class=
"me-3"
id=
"confirm-delete"
data-action=
"{{ route('owner.settings.store.delete', ['id' => Crypt::encrypt($store->id)]) }}"
>
<img
src=
"{{ URL::asset('assets/img/icons/delete.svg') }}"
alt=
"img"
/>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</section>
</div>
@endif
</div>
</div>
</div>
@endsection
<?php
$title
=
e
(
$__env
->
yieldContent
(
'title'
));
$type
=
Session
::
get
(
'type'
);
$msg
=
Session
::
get
(
$type
);
// dd($type);
?>
@section('forscript')
{{-- Toast import js --}}
<script
src=
"{{ URL::asset('/assets/plugins/toastr/toastr.min.js') }}"
></script>
<script
src=
"{{ URL::asset('/assets/plugins/toastr/toastr.js') }}"
></script>
<script>
let
type
=
{
!!
json_encode
(
$type
)
!!
};
let
msg
=
{
!!
json_encode
(
$msg
)
!!
};
const
title
=
{
!!
json_encode
(
$title
)
!!
};
@
if
(
Session
::
has
(
$type
))
{
toastr
[
type
](
msg
,
title
,
{
closeButton
:
!
0
,
tapToDismiss
:
!
1
,
positionClass
:
'
toast-top-center
'
,
})
}
@
endif
</script>
<script>
$
(
document
).
on
(
'
click
'
,
'
#confirm-delete
'
,
function
(
event
)
{
event
.
preventDefault
();
const
url
=
$
(
this
).
data
(
'
action
'
);
Swal
.
fire
({
title
:
'
Are you sure?
'
,
text
:
"
You won't be able to revert this!
"
,
icon
:
'
warning
'
,
showCancelButton
:
true
,
confirmButtonColor
:
'
#dc3545
'
,
cancelButtonColor
:
'
#6c757d
'
,
confirmButtonText
:
'
Yes, delete it!
'
}).
then
((
result
)
=>
{
if
(
result
.
isConfirmed
)
{
$
.
ajax
({
url
,
headers
:
{
'
X-CSRF-TOKEN
'
:
$
(
'
meta[name="csrf-token"]
'
).
attr
(
'
content
'
)
},
type
:
'
GET
'
,
success
:
function
(
data
)
{
Swal
.
fire
({
title
:
'
Deleted!
'
,
text
:
'
Your file has been deleted.
'
,
icon
:
'
success
'
,
timer
:
1500
,
showConfirmButton
:
false
});
location
.
reload
();
},
error
:
function
(
data
)
{
Swal
.
fire
({
title
:
'
Oops...
'
,
text
:
'
Something went wrong!
'
,
icon
:
'
error
'
,
confirmButtonColor
:
'
#dc3545
'
})
}
});
}
});
});
</script>
@endsection
This diff is collapsed.
Click to expand it.
routes/owner.php
View file @
67956ef5
...
...
@@ -4,6 +4,7 @@
use
App\Http\Controllers\Owner\DashboardController
;
use
App\Http\Controllers\Owner\Products\ProductBrandController
;
use
App\Http\Controllers\Owner\Products\ProductsCategoryController
;
use
App\Http\Controllers\Owner\Settings\StoreController
;
use
Illuminate\Support\Facades\Route
;
Route
::
group
([
'prefix'
=>
'owner'
,
'as'
=>
'owner.'
,
'middleware'
=>
[
'auth'
,
'role:owner'
]],
function
()
{
...
...
@@ -19,8 +20,10 @@
Route
::
group
([
'middleware'
=>
[
'hasStore'
]],
function
()
{
Route
::
get
(
'dashboard'
,
[
DashboardController
::
class
,
'index'
])
->
name
(
'dashboard'
);
Route
::
get
(
'{id}'
,
[
DashboardController
::
class
,
'setSession'
])
->
name
(
'setSession'
);
Route
::
get
(
''
,
[
DashboardController
::
class
,
'deleteSession'
])
->
name
(
'deleteSession'
);
Route
::
group
([
'prefix'
=>
'products'
,
'as'
=>
'products.'
,
'middleware'
=>
[
'hasShop'
]
],
function
()
{
Route
::
group
([
'prefix'
=>
'products'
,
'as'
=>
'products.'
],
function
()
{
Route
::
get
(
''
,
[]);
// untuk products
Route
::
group
([
'prefix'
=>
'category'
,
'as'
=>
'category.'
],
function
()
{
Route
::
get
(
''
,
[
ProductsCategoryController
::
class
,
'index'
])
->
name
(
'index'
);
...
...
@@ -39,5 +42,16 @@
Route
::
get
(
'{id}'
,
[
ProductBrandController
::
class
,
'destroy'
])
->
name
(
'delete'
);
});
});
Route
::
group
([
'prefix'
=>
'settings'
,
'as'
=>
'settings.'
],
function
()
{
Route
::
group
([
'prefix'
=>
'store'
,
'as'
=>
'store.'
],
function
()
{
Route
::
get
(
''
,
[
StoreController
::
class
,
'index'
])
->
name
(
'index'
);
Route
::
get
(
'add'
,
[
StoreController
::
class
,
'create'
])
->
name
(
'add'
);
Route
::
post
(
''
,
[
StoreController
::
class
,
'store'
])
->
name
(
'store'
);
Route
::
get
(
'{id}/edit'
,
[
StoreController
::
class
,
'edit'
])
->
name
(
'edit'
);
Route
::
put
(
'{id}'
,
[
StoreController
::
class
,
'update'
])
->
name
(
'update'
);
Route
::
get
(
'{id}'
,
[
StoreController
::
class
,
'destroy'
])
->
name
(
'delete'
);
});
});
});
});
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment