diff --git a/TODO.md b/TODO.md index 705f392..cdc17c4 100644 --- a/TODO.md +++ b/TODO.md @@ -34,4 +34,8 @@ - [x] tambah logo bank - [x] tambah setor tunai - [x] pengaturan share dapat menggunakan html -- [ ] menu mitrawbb +- [ ] menu mitrawbb (list, topup limit mitra -> after save redirect topup limit, + tambah batas bayar -> after save redirect history penambahan batas bayar) +- [ ] menu mitra wbb ada tombol tambah mitra untuk registrasi dengan full form (edit tetap di customer) +- [ ] untuk detail mitra nanti akan ada button untuk (transaksi mitra dengan cakupan: pembelian voucher, pembayaran hutang, + topuplimit, penambahan batas bayar, history deposit) diff --git a/app/Http/Controllers/Admin/CustomerController.php b/app/Http/Controllers/Admin/CustomerController.php index d91fd05..1b6461f 100644 --- a/app/Http/Controllers/Admin/CustomerController.php +++ b/app/Http/Controllers/Admin/CustomerController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Customer; +use App\Models\CustomerAsDataPartner; use App\Models\CustomerLevel; use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; @@ -96,7 +97,7 @@ class CustomerController extends Controller public function edit(Customer $customer) { return inertia('Customer/Form', [ - 'customer' => $customer->load(['level']), + 'customer' => $customer->load(['level', 'partner']), 'levels' => CustomerLevel::all(), 'statuses' => Customer::STATUS ]); @@ -168,4 +169,47 @@ class CustomerController extends Controller return redirect()->route('customer.index') ->with('message', ['type' => 'success', 'message' => 'Item has beed updated']); } + + public function update_partner(Request $request, Customer $customer) + { + $request->validate([ + 'job' => 'required|string', + 'image_selfie' => 'nullable|file', + 'file_statement' => 'nullable|file', + 'file_agreement' => 'nullable|file', + 'items' => 'nullable|array', + 'items.*.name' => 'nullable|string', + 'items.*.type' => 'required|in:text,file', + 'items.*.value' => 'nullable|string', + ]); + // + + $partner = CustomerAsDataPartner::updateOrCreate([ + 'customer_id' => $customer->id, + ], [ + 'job' => $request->job, + 'additional_json' => json_encode($request->items), + ]); + + if ($request->hasFile('image_selfie')) { + $file = $request->file('image_selfie'); + $file->store('uploads', 'public'); + $partner->update(['image_selfie' => $file->hashName('uploads')]); + } + + if ($request->hasFile('file_statement')) { + $file = $request->file('file_statement'); + $file->store('uploads', 'public'); + $partner->update(['file_statement' => $file->hashName('uploads')]); + } + + if ($request->hasFile('file_agreement')) { + $file = $request->file('file_agreement'); + $file->store('uploads', 'public'); + $partner->update(['file_statement' => $file->hashName('uploads')]); + } + + return redirect()->route('customer.index') + ->with('message', ['type' => 'success', 'message' => 'Item has beed updated']); + } } diff --git a/app/Http/Controllers/Admin/DepositController.php b/app/Http/Controllers/Admin/DepositController.php index 2be4823..a57e231 100644 --- a/app/Http/Controllers/Admin/DepositController.php +++ b/app/Http/Controllers/Admin/DepositController.php @@ -42,6 +42,11 @@ class DepositController extends Controller ]); } + // TODO: ubah deposit confirm menggunakan page form + public function edit(DepositHistory $deposit) + { + } + public function update(Request $request, DepositHistory $deposit) { $request->validate([ diff --git a/app/Http/Controllers/Admin/GeneralController.php b/app/Http/Controllers/Admin/GeneralController.php index 64684c4..826f24d 100644 --- a/app/Http/Controllers/Admin/GeneralController.php +++ b/app/Http/Controllers/Admin/GeneralController.php @@ -117,6 +117,7 @@ class GeneralController extends Controller public function upload(Request $request) { $request->validate(['image' => 'required|file']); + $file = $request->file('image'); $file->store('uploads', 'public'); diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 173c2db..0f43125 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -271,6 +271,16 @@ class Customer extends Authenticatable return $this->hasMany(CustomerCart::class); } + public function locationFavorites() + { + return $this->belongsToMany(Location::class, CustomerLocationFavorite::class); + } + + public function partner() + { + return $this->hasOne(CustomerAsDataPartner::class); + } + public function repayPaylater(DepositHistory $deposit): void { if ($this->paylater != null && $this->paylater->usage > 0) { @@ -289,9 +299,4 @@ class Customer extends Authenticatable $deposit->update_customer_balance(); } } - - public function locationFavorites() - { - return $this->belongsToMany(Location::class, CustomerLocationFavorite::class); - } } diff --git a/app/Models/CustomerAsDataPartner.php b/app/Models/CustomerAsDataPartner.php new file mode 100644 index 0000000..3589d36 --- /dev/null +++ b/app/Models/CustomerAsDataPartner.php @@ -0,0 +1,51 @@ +image_selfie != null) { + return asset($this->image_selfie); + } + return null; + }); + } + public function fileStatementUrl(): Attribute + { + return Attribute::make(get: function () { + if ($this->file_statement != null) { + return asset($this->file_statement); + } + return null; + }); + } + public function fileAgreementUrl(): Attribute + { + return Attribute::make(get: function () { + if ($this->file_agreement != null) { + return asset($this->file_agreement); + } + return null; + }); + } +} diff --git a/app/Models/PaylaterCustomer.php b/app/Models/PaylaterCustomer.php index 129540c..6503542 100644 --- a/app/Models/PaylaterCustomer.php +++ b/app/Models/PaylaterCustomer.php @@ -9,5 +9,7 @@ class PaylaterCustomer extends Model 'usage', 'description', 'customer_id', + 'day_deadline', + 'day_deadline_at' ]; } diff --git a/app/Models/PaylaterHistory.php b/app/Models/PaylaterHistory.php index 1149a44..1a1efc9 100644 --- a/app/Models/PaylaterHistory.php +++ b/app/Models/PaylaterHistory.php @@ -7,11 +7,34 @@ use Illuminate\Support\Carbon; class PaylaterHistory extends Model { + const STATUS_VALID = 0; + + const STATUS_WAIT_UPLOAD = 1; + + const STATUS_WAIT_APPROVE = 2; + + const STATUS_WAIT_PAYMENT = 3; + + const STATUS_INVALID = 4; + + const STATUS_REJECT = 5; + + const STATUS_EXPIRED = 6; + + const TYPE_PAYMENT = 0; + + const TYPE_UPGRADE = 1; + + const TYPE_REPAYMENT = 3; + protected $fillable = [ 'debit', 'credit', 'description', 'customer_id', + 'type', + 'is_valid', + 'image_prove' ]; protected $appends = [ @@ -24,7 +47,10 @@ class PaylaterHistory extends Model { $customer = Customer::find($this->customer_id); $paylater = $customer->paylater; - $paylater->update(['usage' => $paylater->usage + $this->debit - $this->credit]); + $paylater->update([ + 'usage' => $paylater->usage + $this->debit - $this->credit, + // TODO: add day dateline + ]); } public function formatHumanCreatedAt(): Attribute diff --git a/database/migrations/2023_06_03_033734_create_paylater_histories_table.php b/database/migrations/2023_06_03_033734_create_paylater_histories_table.php index b56049b..a878785 100644 --- a/database/migrations/2023_06_03_033734_create_paylater_histories_table.php +++ b/database/migrations/2023_06_03_033734_create_paylater_histories_table.php @@ -18,6 +18,9 @@ return new class extends Migration $table->decimal('credit', 20, 2)->default(0); $table->text('description')->nullable(); $table->ulid('customer_id')->nullable(); + $table->smallInteger('type')->default(0); + $table->smallInteger('is_valid')->default(0); + $table->string('image_prove'); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2023_06_04_234950_create_paylater_customers_table.php b/database/migrations/2023_06_04_234950_create_paylater_customers_table.php index f907dde..6a9162b 100644 --- a/database/migrations/2023_06_04_234950_create_paylater_customers_table.php +++ b/database/migrations/2023_06_04_234950_create_paylater_customers_table.php @@ -18,6 +18,8 @@ return new class extends Migration $table->ulid('customer_id')->nullable(); $table->decimal('limit', 20, 2)->default(0); $table->decimal('usage', 20, 2)->default(0); + $table->smallInteger('day_deadline')->default(0); + $table->timestamp('day_deadline_at')->nullable(); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2023_06_28_142741_create_customer_as_data_partners_table.php b/database/migrations/2023_06_28_142741_create_customer_as_data_partners_table.php new file mode 100644 index 0000000..36cfbc6 --- /dev/null +++ b/database/migrations/2023_06_28_142741_create_customer_as_data_partners_table.php @@ -0,0 +1,39 @@ +ulid('id')->primary(); + + $table->ulid('customer_id')->nullable(); + $table->string('job')->nullable(); + $table->string('image_selfie')->nullable(); + $table->string('file_statement')->nullable(); + $table->string('file_agreement')->nullable(); + $table->text('additional_json')->nullable(); + + $table->timestamps(); + $table->softDeletes(); + $table->ulid('created_by')->nullable(); + $table->ulid('updated_by')->nullable(); + $table->ulid('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('customer_as_data_partners'); + } +}; diff --git a/package-lock.json b/package-lock.json index b05c4be..5598f38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,8 +7,8 @@ "dependencies": { "@tinymce/tinymce-react": "^4.3.0", "chart.js": "^4.3.0", - "flowbite": "^1.6.3", - "flowbite-react": "^0.3.8", + "flowbite": "^1.6.6", + "flowbite-react": "^0.4.9", "is": "^3.3.0", "moment": "^2.29.4", "nprogress": "^0.2.0", @@ -35,7 +35,7 @@ "postcss": "^8.4.18", "react": "^18.2.0", "react-dom": "^18.2.0", - "tailwindcss": "^3.2.1", + "tailwindcss": "^3.3.2", "vite": "^4.0.0" } }, @@ -769,11 +769,11 @@ } }, "node_modules/@floating-ui/react": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.16.0.tgz", - "integrity": "sha512-h+69TJSAY2R/k5rw+az56RzzDFc/Tg7EHn/qEgwkIVz56Zg9LlaRMMUvxkcvd+iN3CNFDLtEnDlsXnpshjsRsQ==", + "version": "0.24.3", + "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.24.3.tgz", + "integrity": "sha512-wWC9duiog4HmbgKSKObDRuXqMjZR/6m75MIG+slm5CVWbridAjK9STcnCsGYmdpK78H/GmzYj4ADVP8paZVLYQ==", "dependencies": { - "@floating-ui/react-dom": "^1.1.2", + "@floating-ui/react-dom": "^2.0.1", "aria-hidden": "^1.1.3", "tabbable": "^6.0.1" }, @@ -783,11 +783,11 @@ } }, "node_modules/@floating-ui/react-dom": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-1.3.0.tgz", - "integrity": "sha512-htwHm67Ji5E/pROEAr7f8IKFShuiCKHwUC/UY4vC3I5jiSvGFAYnSYiZO5MlGmads+QqvUkR9ANHEguGrDv72g==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.1.tgz", + "integrity": "sha512-rZtAmSht4Lry6gdhAJDrCp/6rKN7++JnL1/Anbr/DdeyYXQPxvg/ivrbYvJulbRf4vL8b212suwMM2lxbv+RQA==", "dependencies": { - "@floating-ui/dom": "^1.2.1" + "@floating-ui/dom": "^1.3.0" }, "peerDependencies": { "react": ">=16.8.0", @@ -1164,9 +1164,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001508", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001508.tgz", - "integrity": "sha512-sdQZOJdmt3GJs1UMNpCCCyeuS2IEGLXnHyAo9yIO5JJDjbjoVRij4M1qep6P6gFpptD1PqIYgzM+gwJbOi92mw==", + "version": "1.0.30001509", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001509.tgz", + "integrity": "sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==", "dev": true, "funding": [ { @@ -1568,17 +1568,17 @@ } }, "node_modules/flowbite-react": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.3.8.tgz", - "integrity": "sha512-IzbpvnUBDXsdf3HflbYv2W1lmTXITizMaX4G0SYoh/GxSp+25E97yNuwdBItwtCacUU1MJLwqIYXeicAxScRfA==", + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/flowbite-react/-/flowbite-react-0.4.9.tgz", + "integrity": "sha512-azrWNzzjQcnjnNGkjEP1wzw9g10t3LzBC0LEgHN2uvUvm4Sj4W/9MrT27FsPIeEBhlSBMRpSx58/mtYRDgXXgQ==", "dependencies": { - "@floating-ui/react": "^0.16.0", - "classnames": "^2.3.2", - "react-icons": "^4.6.0", - "react-indiana-drag-scroll": "^2.2.0" + "@floating-ui/react": "^0.24.3", + "flowbite": "^1.6.6", + "react-icons": "^4.10.1", + "react-indiana-drag-scroll": "^2.2.0", + "tailwind-merge": "^1.13.2" }, "peerDependencies": { - "flowbite": "^1", "react": "^18", "react-dom": "^18", "tailwindcss": "^3" @@ -2840,6 +2840,15 @@ "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" }, + "node_modules/tailwind-merge": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-1.13.2.tgz", + "integrity": "sha512-R2/nULkdg1VR/EL4RXg4dEohdoxNUJGLMnWIQnPKL+O9Twu7Cn3Rxi4dlXkDzZrEGtR+G+psSXFouWlpTyLhCQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, "node_modules/tailwindcss": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.2.tgz", diff --git a/package.json b/package.json index a430516..04f10c7 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,7 @@ "@vitejs/plugin-react": "^3.0.0", "autoprefixer": "^10.4.12", "axios": "^1.1.2", - "laravel-vite-plugin": "^0.7.2", - "lodash": "^4.17.19", + "laravel-vite-plugin": "^0.7.5", "postcss": "^8.4.18", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -20,10 +19,11 @@ "vite": "^4.0.0" }, "dependencies": { + "lodash": "^4.17.19", "@tinymce/tinymce-react": "^4.3.0", "chart.js": "^4.3.0", - "flowbite": "^1.6.3", - "flowbite-react": "^0.3.8", + "flowbite": "^1.6.6", + "flowbite-react": "^0.4.9", "is": "^3.3.0", "moment": "^2.29.4", "nprogress": "^0.2.0", @@ -38,4 +38,4 @@ "react-use": "^17.4.0", "tinymce": "^6.4.2" } -} +} \ No newline at end of file diff --git a/postcss.config.js b/postcss.config.js index 67cdf1a..60814e5 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,7 @@ module.exports = { plugins: { + 'postcss-import': {}, tailwindcss: {}, autoprefixer: {}, }, -}; +} diff --git a/resources/js/Components/Checkbox.jsx b/resources/js/Components/Checkbox.jsx index cc1031f..9c5e79d 100644 --- a/resources/js/Components/Checkbox.jsx +++ b/resources/js/Components/Checkbox.jsx @@ -17,7 +17,7 @@ export default function Checkbox({ onChange={onChange} name={name} disabled={disabled} - className="w-4 h-4 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" + className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" /> {label !== '' && ( )} {preview && preview} +
+
inputRef.current.click()} + > + Choose File +
+
+ {isEmpty(inputRef.current?.value) + ? 'No choosen file' + : inputRef.current.value} +
+
Sign in - {/* - forgot password - */}
diff --git a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx index ec4636e..5540b31 100644 --- a/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx +++ b/resources/js/Customer/Deposit/DetailPartials/FormUploadCashDeposit.jsx @@ -65,7 +65,7 @@ export const FormUploadCashDeposit = () => { bukti Pembayaran
{ bukti transfer
- Lunasi pinjaman kamu dengan melakukan topup deposit + lunasi pinjaman kamu sebelum jatuh tempo pada ...
diff --git a/resources/js/Customer/PoinExchange/Index.jsx b/resources/js/Customer/PoinExchange/Index.jsx index 2a5c928..4b324ce 100644 --- a/resources/js/Customer/PoinExchange/Index.jsx +++ b/resources/js/Customer/PoinExchange/Index.jsx @@ -14,7 +14,7 @@ import { isEmpty } from 'lodash' const EmptyHere = () => { return (
-
Voucher segera tersedia
+
Belum ada data tersedia
Yuk, share referral kamu untuk tingkatkan poinnya
diff --git a/resources/js/Layouts/AuthenticatedLayout.jsx b/resources/js/Layouts/AuthenticatedLayout.jsx index 9c2349b..2427867 100644 --- a/resources/js/Layouts/AuthenticatedLayout.jsx +++ b/resources/js/Layouts/AuthenticatedLayout.jsx @@ -3,12 +3,25 @@ import { ToastContainer, toast } from 'react-toastify' import ApplicationLogo from '@/Components/Defaults/ApplicationLogo' import Dropdown from '@/Components/Defaults/Dropdown' import { Link, usePage } from '@inertiajs/react' -import { Breadcrumb } from 'flowbite-react' +import { Breadcrumb, Flowbite } from 'flowbite-react' import { HiMenu, HiChevronDown, HiHome } from 'react-icons/hi' import { router } from '@inertiajs/react' import SidebarNav from './Partials/SidebarNav' import { HiOutlineBell } from 'react-icons/hi2' +const customTheme = { + button: { + color: { + primary: 'bg-blue-700 hover:bg-blue-600 text-white', + }, + }, + dropdown: { + color: { + primary: 'bg-blue-700 hover:bg-blue-600 text-white', + }, + }, +} + export default function Authenticated({ children, page = '', @@ -33,179 +46,189 @@ export default function Authenticated({ }, [flash]) return ( -
- - -
-
- + +

{page}

+
+ {typeof action === 'string' && ( + {action} + )} + {typeof action === 'object' && + action.map((item) => ( + + {item} + + ))} + + )} +
{children}
+
-
- {page !== '' && ( - - parent === null - ? router.visit(route('dashboard')) - : router.visit(parent) - } - > - -

{page}

-
- {typeof action === 'string' && ( - {action} - )} - {typeof action === 'object' && - action.map((item) => ( - - {item} - - ))} -
- )} -
{children}
-
+
- -
+ ) } diff --git a/resources/js/Layouts/Partials/SidebarNav.jsx b/resources/js/Layouts/Partials/SidebarNav.jsx index f4d1937..5c21a8c 100644 --- a/resources/js/Layouts/Partials/SidebarNav.jsx +++ b/resources/js/Layouts/Partials/SidebarNav.jsx @@ -9,11 +9,11 @@ const Item = ({ item, children }) => { const Icon = () => item.icon({ className: - 'w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white', + 'w-6 h-6 text-gray-500 transition duration-75 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white', }) const isActive = route().current(item.active) const className = `flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 ${ - isActive && 'bg-gray-200' + isActive && 'bg-gray-200 dark:bg-gray-700' }` return ( @@ -32,7 +32,7 @@ const SubItem = ({ item, children }) => { }) const isActive = route().current(item.active) const className = `flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700 ${ - isActive && 'bg-gray-200' + isActive && 'bg-gray-200 dark:bg-gray-700' }` return ( diff --git a/resources/js/Layouts/Partials/routes.js b/resources/js/Layouts/Partials/routes.js index d0e342b..6c9ae7b 100644 --- a/resources/js/Layouts/Partials/routes.js +++ b/resources/js/Layouts/Partials/routes.js @@ -14,6 +14,7 @@ import { HiArchiveBox, HiBanknotes, HiCheckBadge, + HiClipboardDocumentList, HiCog8Tooth, HiCreditCard, HiCurrencyDollar, @@ -115,7 +116,7 @@ export default [ { name: 'List', show: true, - icon: HiUserCircle, + icon: HiClipboardDocumentList, route: route('customer.index'), active: 'customer.*', permission: 'view-customer', @@ -146,6 +147,45 @@ export default [ }, ], }, + { + name: 'Mitra WBB', + show: true, + icon: HiUserCircle, + items: [ + { + name: 'List', //daftar mitra dan stats + show: true, + icon: HiClipboardDocumentList, + route: route('customer.index'), + active: 'customer.*', + permission: 'view-customer', + }, + { + name: 'Pembayaran Hutang', // daftar pembayaran hutang yang perlu di konfirmasi , dan ada tombol add untuk pembayaran hutang oleh admin + show: true, + icon: HiCash, + route: route('setting.affilate'), + active: 'setting.affilate', + permission: 'view-setting-affilate', + }, + { + name: 'Tambah Limit', // form tambah limit, pilih mitra/customer dan limit + show: true, + icon: HiArrowCircleUp, + route: route('customer-level.index'), + active: 'customer-level.*', + permission: 'view-customer-level', + }, + { + name: 'Tambah Tenor', // form tambah limit , pilih mitra dengan penambahan tenor + show: true, + icon: HiArrowCircleUp, + route: route('setting.affilate'), + active: 'setting.affilate', + permission: 'view-setting-affilate', + }, + ], + }, { name: 'Admin', show: true, diff --git a/resources/js/Pages/Account/Index.jsx b/resources/js/Pages/Account/Index.jsx index a9c9dba..934e029 100644 --- a/resources/js/Pages/Account/Index.jsx +++ b/resources/js/Pages/Account/Index.jsx @@ -42,7 +42,9 @@ export default function Account(props) {
{canCreate && ( - + )}
@@ -109,6 +111,7 @@ export default function Account(props) {
-
diff --git a/resources/js/Pages/Banner/Index.jsx b/resources/js/Pages/Banner/Index.jsx index 77ed89f..9f762d1 100644 --- a/resources/js/Pages/Banner/Index.jsx +++ b/resources/js/Pages/Banner/Index.jsx @@ -1,6 +1,5 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import { Link, router } from '@inertiajs/react' -import { usePrevious } from 'react-use' import { Head } from '@inertiajs/react' import { Button, Dropdown } from 'flowbite-react' import { HiPencil, HiTrash } from 'react-icons/hi' @@ -44,7 +43,9 @@ export default function Info(props) {
{canCreate && ( - + )}
@@ -79,6 +80,7 @@ export default function Info(props) { { - const { - props: { customer, statuses }, - } = usePage() - - const { data, setData, post, processing, errors } = useForm({ - username: '', - password: '', - name: '', - fullname: '', - address: '', - phone: '', - image: '', - image_url: '', - status: 0, - }) - - const handleOnChange = (event) => { - setData( - event.target.name, - event.target.type === 'checkbox' - ? event.target.checked - ? 1 - : 0 - : event.target.value - ) - } - const handleSubmit = () => { - if (isEmpty(customer) === false) { - post(route('customer.update', customer)) - return - } - post(route('customer.store')) - } - - useEffect(() => { - if (isEmpty(customer) === false) { - setData({ - username: customer.username, - password: customer.password, - name: customer.name, - fullname: customer.fullname, - address: customer.address, - phone: customer.phone, - image_url: customer.image_url, - status: customer.status, - }) - } - }, [customer]) - - return ( -
-
Profile
- - - +62
} - name="phone" - value={data.phone} - onChange={handleOnChange} - error={errors.phone} - formClassName={'pl-10'} - label="Whatsapp" - /> -