change
This commit is contained in:
@@ -14,10 +14,12 @@ use App\Exports\customer_export;
|
||||
use App\Exports\customer_export_selected;
|
||||
use App\Exports\CustomerExportSelected;
|
||||
use App\Models\ManageRestaurant;
|
||||
use App\Models\ManageState;
|
||||
use App\Models\RedeemRestaurant;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Barryvdh\DomPDF\PDF as DomPDFPDF;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use PDF;
|
||||
|
||||
@@ -27,7 +29,7 @@ use PDF;
|
||||
class ManageCustomerController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get User Page.
|
||||
@@ -47,7 +49,7 @@ class ManageCustomerController extends Controller
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get Passport Page.
|
||||
@@ -64,7 +66,7 @@ class ManageCustomerController extends Controller
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get Customer data.
|
||||
@@ -74,69 +76,84 @@ class ManageCustomerController extends Controller
|
||||
{
|
||||
|
||||
try {
|
||||
$customers_data = IamPrincipal::findOrFail($id);
|
||||
return view('Admin.pages.manage_users.manage_customer.edit_customer', compact('customers_data'));
|
||||
$customers_data = IamPrincipal::with('state')->findOrFail($id);
|
||||
$state = ManageState::where('is_active', 1)->get();
|
||||
return view('Admin.pages.manage_users.manage_customer.edit_customer', compact('customers_data', 'state'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Update Customer Form.
|
||||
*/
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
// Validation rules
|
||||
$rules = [
|
||||
'email_address' => [
|
||||
'required',
|
||||
'string',
|
||||
'email',
|
||||
'max:100',
|
||||
Rule::unique('iam_principal')->where(function ($query) use ($request) {
|
||||
return $query->where('principal_type_xid', 3)
|
||||
->whereNull('deleted_at')
|
||||
->where('id', '!=', $request->customer_id);
|
||||
}),
|
||||
],
|
||||
];
|
||||
public function update(Request $request)
|
||||
{
|
||||
// Validation rules
|
||||
$rules = [
|
||||
'email_address' => [
|
||||
'required',
|
||||
'string',
|
||||
'email',
|
||||
'max:100',
|
||||
Rule::unique('iam_principal')->where(function ($query) use ($request) {
|
||||
return $query->where('principal_type_xid', 3)
|
||||
->whereNull('deleted_at')
|
||||
->where('id', '!=', $request->customer_id);
|
||||
}),
|
||||
],
|
||||
'date_of_birth' => [
|
||||
'required',
|
||||
'date',
|
||||
function ($attribute, $value, $fail) {
|
||||
$dob = Carbon::parse($value);
|
||||
$age = $dob->age;
|
||||
if ($age < 21) {
|
||||
$fail('You must be at least 21 years old.');
|
||||
}
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
$messages = [
|
||||
$messages = [
|
||||
'email_address.required' => 'Enter email address',
|
||||
'email_address.email' => 'Please enter a valid email address',
|
||||
'email_address.unique' => 'This email is already registered',
|
||||
'date_of_birth.required' => 'Date of Birth is required',
|
||||
'date_of_birth.date' => 'Please enter a valid date',
|
||||
];
|
||||
|
||||
'email_address.required' => 'Enter email address',
|
||||
'email_address.email' => 'Please enter a valid email address',
|
||||
'email_address.unique' => 'This email is already registered',
|
||||
];
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$customer_data = IamPrincipal::where('id', $request->customer_id)->first();
|
||||
$customer_data->first_name = $request->input('name');
|
||||
$customer_data->last_name = $request->input('last_name');
|
||||
$customer_data->phone_number = $request->input('phone');
|
||||
$customer_data->email_address = $request->input('email_address');
|
||||
$customer_data->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return jsonResponseWithSuccessMessage(__('success.update_data'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("updateCustomerNewsArticle Services Page Load Failed " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$customer_data = IamPrincipal::where('id', $request->customer_id)->first();
|
||||
$customer_data->first_name = $request->input('name');
|
||||
$customer_data->last_name = $request->input('last_name');
|
||||
$customer_data->phone_number = $request->input('phone');
|
||||
$customer_data->email_address = $request->input('email_address');
|
||||
$customer_data->date_of_birth = $request->input('date_of_birth');
|
||||
$customer_data->state_xid = $request->input('state_xid');
|
||||
$customer_data->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return jsonResponseWithSuccessMessage(__('success.update_data'));
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("updateCustomerNewsArticle Services Page Load Failed " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function archive_customer()
|
||||
{
|
||||
/*
|
||||
@@ -180,7 +197,7 @@ class ManageCustomerController extends Controller
|
||||
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Get pdf.
|
||||
@@ -220,7 +237,7 @@ class ManageCustomerController extends Controller
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
/*
|
||||
Created By : Sayali Parab
|
||||
Created at : 28 May 2024
|
||||
Use : To Deleted Data Restore.
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('feedback_reaction', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('feedback_reaction_xid')->nullable();
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->integer('modified_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('feedback_reaction');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('manage_feedback', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Foreign key references for principal
|
||||
$table->unsignedBigInteger('principal_xid');
|
||||
$table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade');
|
||||
|
||||
// Feedback reaction and comment columns
|
||||
|
||||
$table->unsignedBigInteger('feedback_reaction_xid');
|
||||
$table->foreign('feedback_reaction_xid')->references('id')->on('feedback_reaction')->onDelete('cascade');
|
||||
|
||||
$table->longtext('comment')->nullable();
|
||||
|
||||
// Soft deletes, timestamps, and additional columns
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
$table->boolean('is_active')->default(1)->comment('1=Active, 0=Deactive');
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->integer('modified_by')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('manage_feedback');
|
||||
}
|
||||
};
|
||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('principal_xid');
|
||||
$table->foreign('principal_xid')->references('id')->on('iam_principal')->onDelete('cascade');
|
||||
$table->integer('type');
|
||||
$table->string('type');
|
||||
$table->longText('description');
|
||||
$table->string('image')->nullable();
|
||||
$table->timestamp('date_added')->useCurrent();
|
||||
|
||||
@@ -79,12 +79,7 @@
|
||||
<input class="form-check-input" type="checkbox" data-kt-check="true" data-kt-check-target="#kt_table_users .form-check-input" value="1" />
|
||||
</div>
|
||||
</th> -->
|
||||
<th class="w-10px pe-2">
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
|
||||
<input class="form-check-input" type="checkbox" name="customer_ids"
|
||||
id="select-all-ids" />
|
||||
</div>
|
||||
</th>
|
||||
|
||||
<th class="text-start">Sr no</th>
|
||||
<th class="text-start">Full Name</th>
|
||||
<th class="text-start">User ID</th>
|
||||
@@ -102,13 +97,7 @@
|
||||
<tbody class="text-center">
|
||||
@foreach ($customers as $customer)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-check form-check-sm form-check-custom form-check-solid">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="customer_checkbox_ids" name="customer_ids"
|
||||
value="{{ $customer->id }}" />
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="text-start">{{ $loop->iteration }}</td>
|
||||
<!-- <td class="text-start">{{ $customer->first_name }}</td> -->
|
||||
<td class="text-start">{{ $customer->first_name }} {{ $customer->last_name }}
|
||||
|
||||
@@ -1,101 +1,115 @@
|
||||
@extends('Admin.layouts.master')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
$currentPage = 'manage-patient';
|
||||
@endphp
|
||||
<style>
|
||||
.error-message {
|
||||
color: #FF0000;
|
||||
}
|
||||
@php
|
||||
$currentPage = 'manage-patient';
|
||||
@endphp
|
||||
<style>
|
||||
.error-message {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
form .error-message {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<div class="layout-px-spacing">
|
||||
<div class="middle-content container-xxl p-0">
|
||||
<div class="row layout-top-spacing ">
|
||||
<div class="top-tabel">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- <h6 class="card-title">Edit Manage Customers</h6> -->
|
||||
<a class="d-flex align-items-center justify-content-center pl-2"
|
||||
href="{{ route('manage.customer')}}">
|
||||
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg')}}">
|
||||
<h6 class="card-title p-0">Edit Manage Customers</h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
form .error-message {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
<div class="layout-px-spacing">
|
||||
<div class="middle-content container-xxl p-0">
|
||||
<div class="row layout-top-spacing ">
|
||||
<div class="top-tabel">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- <h6 class="card-title">Edit Manage Customers</h6> -->
|
||||
<a class="d-flex align-items-center justify-content-center pl-2"
|
||||
href="{{ route('manage.customer') }}">
|
||||
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
|
||||
<h6 class="card-title p-0">Edit Manage Customers</h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="widget-content widget-content-area br-8 position-btn h-10">
|
||||
<div class="view-details Article">
|
||||
<form id="customer_user_form">
|
||||
<input type="hidden" name="customer_id" class="form-control" value="{{$customers_data->id}}">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">first name</label>
|
||||
<input type="text" name="name" class="form-control" value="{{$customers_data->first_name}} ">
|
||||
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
|
||||
<div class="widget-content widget-content-area br-8 position-btn h-10">
|
||||
<div class="view-details Article">
|
||||
<form id="customer_user_form">
|
||||
<input type="hidden" name="customer_id" class="form-control"
|
||||
value="{{ $customers_data->id }}">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">first name</label>
|
||||
<input type="text" name="name" class="form-control"
|
||||
value="{{ $customers_data->first_name }} ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Last name</label>
|
||||
<input type="text" name="last_name" class="form-control"
|
||||
value="{{ $customers_data->last_name }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="state" class="label">Location</label>
|
||||
<select id="state" name="state_xid" class="form-control">
|
||||
<option value="">Select State</option>
|
||||
@foreach ($state as $st)
|
||||
<option value="{{ $st->id }}"
|
||||
{{ $customers_data->state_xid == $st->id ? 'selected' : '' }}>
|
||||
{{ $st->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">User ID</label>
|
||||
<input type="text" class="form-control" value="{{ $customers_data->id }}">
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Phone Number</label>
|
||||
<input type="text" name="phone" class="form-control"
|
||||
value="{{ $customers_data->phone_number }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Email ID</label>
|
||||
<input type="text" name="email_address" class="form-control"
|
||||
value="{{ $customers_data->email_address }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Date of Birth</label>
|
||||
<input type="date" name="date_of_birth" class="form-control"
|
||||
value="{{ $customers_data->date_of_birth }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button type="submit" id="customer_user_btn" class="download-btn-custom mt-3 w-25">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Last name</label>
|
||||
<input type="text" name="last_name" class="form-control" value="{{$customers_data->last_name}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Location</label>
|
||||
<input type="text" class="form-control" value="{{$customers_data->state ? $customers_data->state->name : 'No state assigned' }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">User ID</label>
|
||||
<input type="text" class="form-control" value="{{$customers_data->id }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Phone Number</label>
|
||||
<input type="text" name="phone" class="form-control" value="{{$customers_data->phone_number}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Email ID</label>
|
||||
<input type="text" name="email_address" class="form-control" value="{{$customers_data->email_address}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group ">
|
||||
<label for="company-name" class="label">Date of Birth</label>
|
||||
<input type="date" name="date_of_birth" class="form-control" value="{{$customers_data->date_of_birth}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<button type="submit" id="customer_user_btn" class="download-btn-custom mt-3 w-25" >
|
||||
<span>Save</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('section_script')
|
||||
<script src="{{ asset('public/assets/js/admin/manage_customer/edit.js')}}"></script>
|
||||
<script src="{{ asset('public/assets/js/admin/manage_customer/edit.js') }}"></script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user