Skip to content

Commit

Permalink
Customer profile
Browse files Browse the repository at this point in the history
  • Loading branch information
naharsoftbd committed Feb 9, 2019
1 parent 9d89be6 commit 3229c95
Show file tree
Hide file tree
Showing 9 changed files with 304 additions and 12 deletions.
29 changes: 26 additions & 3 deletions app/Http/Controllers/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,45 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Customer;
use People;
use App\User;
use Auth;

class CustomerController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data['table_headers'] = 'Test';
$data['table_headers'] = User::All();
return view('people.manage', $data);
}

/**
* Customer Profile Page
*/
public function getProfile(){
$user = User::find(Auth::user()->id)->get()->first();
return view('people.user-basic-info',['persons_info'=>$user]);
}

/* Edit Customer Information */
public function getCustomerInfo($id){
$customer = User::find(Auth::user()->id)->get()->first();
return view('people.edit',['customer'=>$customer]);
}

/**
* Show the form for creating a new resource.
*
Expand Down
7 changes: 7 additions & 0 deletions public/css/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@charset "UTF-8";

.card .card-header{
background: #2d67eb;
background: #0094e1;
color:#FFFFFF;
}
69 changes: 68 additions & 1 deletion public/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
$(document).ready( function () {
$('#table_id').DataTable();
} );




$('#confirm-delete').on('click', '.btn-ok', function(e) {
var $modalDiv = $(e.delegateTarget);
var orderid = $(this).data('id');
$.ajax({
type: "POST",
url: host+'/delete-order/'+ orderid,
data: {'id':orderid},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(msg) {

}
});
$modalDiv.addClass('loading');
setTimeout(function() {
$modalDiv.modal('hide').removeClass('loading');
window.location.reload();
}, 1000)
});
$('#confirm-delete').on('show.bs.modal', function(e) {
var orderID = $(e.relatedTarget).data('id');
$(e.currentTarget).find('.btn-ok').attr('data-id', orderID);
});

// edit
$('#confirm-edit').on('click', '.edit-btn-ok', function(e) {
var $modalDiv = $(e.delegateTarget);
$.ajax({
type: "POST",
url: host+'/edit-profile',
data: $('#updatorder').serialize(),
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(msg) {
//alert(msg);
}
});
$modalDiv.addClass('loading');
setTimeout(function() {
$modalDiv.modal('hide').removeClass('loading');
window.location.reload();
}, 1000)
});
$('#confirm-edit').on('show.bs.modal', function(e) {
var userid = $(e.relatedTarget).data('id');
//$(e.currentTarget).find('.btn-ok').attr('data-id', orderID);
alert(userid);
$.ajax({
type: "POST",
url: host+'/get-user/'+ userid,
data: {'id':userid},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(msg) {
$('.edit-content').html(msg);
}
});
});


});
12 changes: 12 additions & 0 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>
<script src="{{ asset('bower_components/datatables.net/js/jquery.dataTables.min.js') }}" defer></script>
<script> var host = "{{URL::to('/')}}"; </script>
<script src="{{ asset('js/custom.js') }}" defer></script>


Expand All @@ -22,6 +23,7 @@
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/jquery.dataTables.css') }}" rel="stylesheet">
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ asset('css/custom.css') }}" rel="stylesheet">
</head>
<body>
Expand Down Expand Up @@ -59,7 +61,17 @@
{{ Auth::user()->name }} <span class="caret"></span>
</a>



<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('profile') }}"
onclick="event.preventDefault();
document.getElementById('profile-form').submit();">
{{ __('Profile') }}
</a>
<form id="profile-form" action="{{ route('profile') }}" method="GET" style="display: none;">
@csrf
</form>
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
Expand Down
107 changes: 107 additions & 0 deletions resources/views/people/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<form role="form" id="updatorder" class="form-horizontal">
@csrf
<div class="row">
<div class="col-lg-6">
<input type="hidden" id="updatorderid" name="id" value="<?php echo $customer->id; ?>">
<div class="form-group">
<label> name </label>
<input class="form-control" placeholder=" Name" name="CutomerName" value="<?php echo $customer->customer_name; ?>" required >

</div>
<div class="form-group">
<label>Contact Number </label>
<input class="form-control" placeholder="Contact Number" name="ContactName" value="<?php echo $customer->contact_number; ?>" required >

</div>
<div class="form-group">
<label>Product Name</label>
<input class="form-control" placeholder="Enter Your Product name" value="<?php echo $customer->product_name; ?>" name="ProductName" required >
</div>
<div class="form-group">
<label>Product Link</label>
<input class="form-control" placeholder="Enter Your Product Link" value="<?php echo $customer->product_link; ?>" name="ProductLink" required >
</div>
<div class="form-group">
<label>Quantity</label>
<input class="form-control" placeholder="Enter Product Quantity" name="Quantity" value="<?php echo $customer->product_qty; ?>" required >
</div>
<div class="form-group">
<label>Sale By</label>
<input class="form-control" placeholder="Enter Sales Man name" Name="SalesBy" value="<?php echo $customer->sale_by; ?>" required >
</div>

<div class="form-group">
<label>Purchased By</label>
<input class="form-control" placeholder="Enter Purchased Man name" Name="PurchasedBy" value="<?php echo $customer->purchased_by; ?>" required >
</div>
<div class="form-group">
<label>Order Status</label>
<input class="form-control" placeholder="Order status" Name="OrderStatus" value="<?php echo $customer->order_status; ?>" required >
</div>
<div class="form-group">
<label>Buying Place</label>
<input class="form-control" placeholder="Buying Place" Name="BuyingPlace" value="<?php echo $customer->bying_place; ?>" required >
</div>
<div class="form-group">
<label>Bkash Last 4 Digit</label>
<input class="form-control" placeholder="4 Digit Bkash" Name="BkashLast4Digit" value="<?php echo $customer->bkash_l4digit; ?>" required>
</div>




</div>
<!-- /.col-lg-6 (nested) -->
<div class="col-lg-6">

<div class="form-group">
<label>Sale Price in dollar</label>
<input class="form-control" placeholder="Enter Your Sale Price in Dollar" name="Sale-Price-in-dollar" value="<?php echo $customer->sale_price_in_dollar; ?>" required >
</div>
<div class="form-group">
<label>Buying Price in dollar</label>
<input class="form-control" placeholder="Enter Your Buying Price in dollar" name="Buying-Price-in-dollar" value="<?php echo $customer->buying_price_in_dollar; ?>" required >
</div>
<div class="form-group">
<label>Actual Buying Price</label>
<input class="form-control" placeholder="Enter Your Actual Buying Price" name="Actual-Buying-Price" value="<?php echo $customer->actual_buying_price; ?>" required >
</div>
<div class="form-group">
<label>Profit Percentage (%)</label>
<input class="form-control" placeholder="Enter Your Profit" name="Profit-Percentage" value="<?php echo $customer->profit_percentage; ?>" required >
</div>

<div class="form-group">
<label>Total Order Amount</label>
<input class="form-control" placeholder="Enter Total Order Amount" name="Total-Order-Amount" value="<?php echo $customer->total_order_amount; ?>" required >
</div>
<div class="form-group">
<label>Bkash Receive</label>
<input class="form-control" placeholder="Enter Bkash Receive Amount" name="Bkash-Receive" value="<?php echo $customer->bkash_receive; ?>" required >
</div>
<div class="form-group">
<label>Advance Adjusted</label>
<select class="form-control" name="Advance-Adjusted" required>
<option>--Select--</option>
<option <?php if($customer->advance_adjusted=='Yes'){ echo 'selected'; } ?> value="Yes">Yes</option>
<option value="No" >NO</option>
</select>
</div>
<div class="form-group">
<label>Card Last 4 Digit</label>
<input class="form-control" placeholder="Enter Card Last 4 Digit" name="Card-Last-4-Digit" value="<?php echo $customer->card_last_4digit; ?>" required >
</div>
<div class="form-group">
<label>Cash Receive</label>
<input class="form-control" placeholder="Enter Cash Receive" name="Cash-Receive" value="<?php echo $customer->cash_receive; ?>" required >
</div>

<div class="form-group">
<label>For Courier charge</label>
<input class="form-control" placeholder="Enter For Courier charge" name="For-Courier-charge" value="<?php echo $customer->for_courier_charge; ?>" required >
</div>


</div>
</div>
</form>
15 changes: 9 additions & 6 deletions resources/views/people/manage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@
@section('content')
<div class="container">
<div id="title_bar" class="btn-toolbar">
<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo __('common.common_submit') ?>' data-href=''
<button class='btn btn-info btn-sm float-right modal-dlg' data-btn-submit='<?php echo __('common.common_submit') ?>' data-href=''
title='<?php __('customer.customers_import_items_excel'); ?>'>
<span class="glyphicon glyphicon-import">&nbsp</span><?php __('common.common_import_excel'); ?>
<span class="glyphicon glyphicon-import">&nbsp</span><?php echo __('common.common_import_excel'); ?>
</button>

<button class='btn btn-info btn-sm pull-right modal-dlg' data-btn-submit='<?php echo __('common.common_submit') ?>' data-href=''
<button class='btn btn-info btn-sm float-right modal-dlg' data-btn-submit='<?php echo __('common.common_submit') ?>' data-href=''
title=''>
<span class="glyphicon glyphicon-user">&nbsp</span>
</button>
</div>

<div id="toolbar">
<div class="pull-left btn-toolbar">
<button id="delete" class="btn btn-default btn-sm">
<button id="delete" class="btn btn-default btn-sm btn-md btn-lg">
<span class="glyphicon glyphicon-trash">&nbsp</span><?php echo __("common.common_delete");?>
</button>
<button id="email" class="btn btn-default btn-sm">
<button id="email" class="btn btn-default btn-sm btn-md btn-lg">
<span class="glyphicon glyphicon-envelope">&nbsp</span><?php echo __("common.common_email");?>
</button>
</div>
</div>
<div id="table_holder">
<?php //var_dump($table_headers->email); ?>
<table id="table_id" class="display">
<thead>
<tr>
Expand All @@ -34,10 +35,12 @@
</tr>
</thead>
<tbody>
@foreach($table_headers as $user)
<tr>
<td>Row 1 Data 1</td>
<td>{{$user->email}}</td>
<td>Row 1 Data 2</td>
</tr>
@endforeach
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
Expand Down
71 changes: 71 additions & 0 deletions resources/views/people/user-basic-info.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

@extends('layouts.app')

@section('content')
<div class="container">
<div class="row justify-content-center" id="SettingsPage_Content">
<div class="col-md-8">
<div class="card">
<div class="card-header">General Account Settings</div>

<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<ul>
<li>{{$persons_info->name}}</li>
<li>{{$persons_info->email}}</li>
</ul>

<a data-id="<?php echo $persons_info->id; ?>" data-toggle="modal" data-target="#confirm-edit" class="btn btn-success float-left">Edit Profile</a>
<a data-toggle="modal" data-target="#confirm-delete" data-id="<?php echo $persons_info->id; ?>" class="btn btn-danger float-right">Delete Account</a>

</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">

<h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<p>You are about to delete <b><i class="title"></i></b> record, this procedure is irreversible.</p>
<p>Do you want to proceed?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger btn-ok">Delete</button>
</div>
</div>
</div>
</div>
<!-- Modal Edit-->
<div class="modal fade" id="confirm-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">

<h4 class="modal-title" id="myModalLabel">Please Save before Closing</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body edit-content">



</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success edit-btn-ok">Save</button>
</div>
</div>
</div>
</div>
@endsection
Loading

0 comments on commit 3229c95

Please sign in to comment.