Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
power
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
254
Issues
254
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pardeep Sahu
power
Commits
cfa878b6
Commit
cfa878b6
authored
3 years ago
by
Pardeep Sahu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sahu_new_10_12_2021' into staging
parents
3c0cdbfa
877bf8bc
Pipeline
#2152
passed with stage
in 18 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
627 additions
and
617 deletions
+627
-617
app/Http/Controllers/ApiController.php
app/Http/Controllers/ApiController.php
+3
-1
app/Http/helpers.php
app/Http/helpers.php
+11
-0
resources/views/admin/addJob.blade.php
resources/views/admin/addJob.blade.php
+3
-1
resources/views/admin/editJob.blade.php
resources/views/admin/editJob.blade.php
+610
-615
No files found.
app/Http/Controllers/ApiController.php
View file @
cfa878b6
...
...
@@ -93,10 +93,12 @@ class ApiController extends Controller
User
::
where
(
'role'
,
3
)
->
where
(
'mobile_no'
,
'='
,
$mobile_no
)
->
update
(
$data
);
if
(
!
empty
(
$matchOtp
->
dealer_id
))
{
$dealer_id
=
$matchOtp
->
dealer_id
;
$dealerPercentage
=
getDealerPercentage
(
$matchOtp
->
dealer_id
);
}
else
{
$dealer_id
=
$matchOtp
->
dealer_office
;
$dealerPercentage
=
"0"
;
}
$result
=
array
(
'user_id'
=>
$matchOtp
->
id
,
'username'
=>
$matchOtp
->
name
,
'dealer_id'
=>
$dealer_id
,
'role'
=>
$matchOtp
->
role
);
$result
=
array
(
'user_id'
=>
$matchOtp
->
id
,
'username'
=>
$matchOtp
->
name
,
'dealer_id'
=>
$dealer_id
,
'role'
=>
$matchOtp
->
role
,
'dealer_percentage'
=>
$dealerPercentage
);
$return
=
array
(
'result'
=>
$result
,
'status_code'
=>
200
);
exit
(
json_encode
(
$return
));
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/helpers.php
View file @
cfa878b6
...
...
@@ -1001,4 +1001,15 @@ function getTaregtNumber($target_id)
{
$data
=
DB
::
table
(
'target_treatments'
)
->
where
(
'target_id'
,
$target_id
)
->
sum
(
'target_num'
);
return
$data
;
}
function
getDealerPercentage
(
$dealer_id
)
{
$percentage
=
DB
::
table
(
'dealer_shares'
)
->
where
(
"dealer_id"
,
$dealer_id
)
->
orderBy
(
"id"
,
"DESC"
)
->
first
()
->
share_percentage
;
if
(
!
empty
(
$percentage
))
{
$percentage
=
$percentage
;
}
else
{
$percentage
=
"0"
;
}
return
$percentage
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
resources/views/admin/addJob.blade.php
View file @
cfa878b6
...
...
@@ -666,7 +666,9 @@ if (@$advisor_id) {
var
customer
=
"
.customer
"
+
a
;
var
actualclass
=
"
.actualPrice
"
+
a
;
var
dealerPercent
=
"
.dealerPercent
"
+
a
;
var
powerShare
=
"
.powerShare
"
+
a
;
var
diff
=
"
.difference
"
+
a
;
var
diffPrice
=
$
(
diff
).
val
();
var
customerPrice
=
$
(
customer
).
val
();
...
...
@@ -679,7 +681,7 @@ if (@$advisor_id) {
// $(diff).val(isNaN(difference)? 0 : difference.toFixed(2));
$
(
actualclass
).
val
(
isNaN
(
actualP
)
?
0
:
actualP
.
toFixed
(
2
));
$
(
dealerPercent
).
val
(
isNaN
(
deal
)
?
0
:
deal
.
toFixed
(
2
));
$
(
"
.powerShare
"
+
a
).
val
((
$
(
actualclass
).
val
()
-
$
(
dealerPercent
).
val
()).
toFixed
(
2
));
$
(
powerShare
).
val
((
$
(
actualclass
).
val
()
-
$
(
dealerPercent
).
val
()).
toFixed
(
2
));
}
});
}
...
...
This diff is collapsed.
Click to expand it.
resources/views/admin/editJob.blade.php
View file @
cfa878b6
...
...
@@ -16,655 +16,650 @@ if (@$advisor_id) {
@section('content')
<link
rel=
"stylesheet"
href=
"{{asset('css/select2.min.css')}}"
>
<div
class=
"content-wrapper"
>
<!-- Content Header (Page header) -->
<section
class=
"content-header"
>
<h1>
Jobs
<!-- <small>advanced tables</small> -->
</h1>
<ol
class=
"breadcrumb"
>
<li><a
href=
"{{url('/admin')}}"
><i
class=
"fa fa-dashboard"
></i>
Dashboard
</a></li>
<li><a
href=
"{{url('/admin/jobs')}}"
><i
class=
"fa fa-tasks"
></i>
Jobs
</a></li>
<li
class=
"active"
>
Edit Job
</li>
</ol>
</section>
<!-- Main content -->
<section
class=
"content"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<div
class=
"box"
>
<div
class=
"box-header"
>
<h3
class=
"box-title"
>
Edit Job
</h3>
<a
href=
"{{ URL::previous() }}"
class=
"btn btn-info floatright"
style=
"margin-right: 10px;"
>
Back
</a>
</div>
<!-- /.box-header -->
<div
class=
"box-body"
>
@if(Session::has('addComErrmsg'))
<p
class=
"alert {{ Session::get('alert-class', 'alert-info') }}"
>
<?php
$msg
=
Session
::
get
(
'addComErrmsg'
);
<!-- Content Header (Page header) -->
<section
class=
"content-header"
>
<h1>
Jobs
<!-- <small>advanced tables</small> -->
</h1>
<ol
class=
"breadcrumb"
>
<li><a
href=
"{{url('/admin')}}"
><i
class=
"fa fa-dashboard"
></i>
Dashboard
</a></li>
<li><a
href=
"{{url('/admin/jobs')}}"
><i
class=
"fa fa-tasks"
></i>
Jobs
</a></li>
<li
class=
"active"
>
Edit Job
</li>
</ol>
</section>
<!-- Main content -->
<section
class=
"content"
>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
<div
class=
"box"
>
<div
class=
"box-header"
>
<h3
class=
"box-title"
>
Edit Job
</h3>
<a
href=
"{{ URL::previous() }}"
class=
"btn btn-info floatright"
style=
"margin-right: 10px;"
>
Back
</a>
</div>
<!-- /.box-header -->
<div
class=
"box-body"
>
@if(Session::has('addComErrmsg'))
<p
class=
"alert {{ Session::get('alert-class', 'alert-info') }}"
>
<?php
$msg
=
Session
::
get
(
'addComErrmsg'
);
foreach
(
$msg
as
$key
=>
$value
)
{
echo
$value
;
?>
<br>
<?php
}
<br>
<?php
}
?>
</p>
<?php
Session
::
forget
(
'addComErrmsg'
);
?>
@endif
@if(Session::has('success'))
<div
class=
"alert alert-success"
>
{{ Session::get('success') }}
</div>
@endif
<form
role=
"form"
id=
"jobform"
method=
"POST"
action=
"{{url('/admin/updateJob')}}"
enctype=
"multipart/form-data"
onsubmit=
"return validateForm()"
>
<input
type=
"hidden"
name=
"_token"
value=
"
<?=
csrf_token
();
?>
"
>
<input
type=
"hidden"
name=
"id"
value=
"{{$result->id}}"
>
<div
class=
"box-body"
>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('job_date') ? ' has-error' : '' }}"
>
<label
for=
"job_date"
>
Job Date
<span
class=
"required-title"
>
*
</span></label>
<div
class=
"input-group date"
>
<div
class=
"input-group-addon"
>
<i
class=
"fa fa-calendar"
></i>
</div>
<input
onkeydown=
"return false"
autocomplete=
"off"
class=
"form-control pull-right"
id=
"datepicker"
value=
"{{ old('job_date',$result->job_date) }}"
type=
"text"
name=
"job_date"
placeholder=
"Enter job date"
>
</div>
@if ($errors->has('job_date'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('job_date') }}
</strong>
</span>
</p>
<?php
Session
::
forget
(
'addComErrmsg'
);
?>
@endif
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('job_card_no') ? ' has-error' : '' }}"
>
<label
for=
"job_card_no"
>
Job Card No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"job_card_no"
class=
"form-control required"
value=
"{{ old('job_card_no',$result->job_card_no) }}"
id=
"job_card_no"
placeholder=
"Enter job card no."
>
@if ($errors->has('job_card_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('job_card_no') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('bill_no') ? ' has-error' : '' }}"
>
<label
for=
"bill_no"
>
Bill No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"bill_no"
class=
"form-control required"
value=
"{{ old('bill_no',$result->bill_no) }}"
id=
"bill_no"
placeholder=
"Enter bill no"
>
@if ($errors->has('bill_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('bill_no') }}
</strong>
</span>
@endif
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('regn_no') ? ' has-error' : '' }}"
>
<label
for=
"regn_no"
>
Regn No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"regn_no"
class=
"form-control required"
value=
"{{ old('regn_no',$result->regn_no) }}"
id=
"regn_no"
placeholder=
"Enter regn no"
>
@if ($errors->has('regn_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('regn_no') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
<div
class=
"form-group{{ $errors->has('dealer_id') ? ' has-error' : '' }}"
>
<label
for=
"dealer_id"
>
Dealer
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"dealer_id"
name=
"dealer_id"
>
<option
value=
""
>
Select Dealer
</option>
@foreach($dealers as $dealer)
<option
@
if
($
result-
>
dealer_id == $dealer->dealer_id) {{ 'selected' }} @endif value="{{$dealer->dealer_id}}">{{$dealer->dealer_name}}
</option>
@endforeach
</select>
@if ($errors->has('dealer_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('dealer_id') }}
</strong>
</span>
@if(Session::has('success'))
<div
class=
"alert alert-success"
>
{{ Session::get('success') }}
</div>
@endif
</div>
</div>
{{--
<div
class=
"col-sm-4"
>
<form
role=
"form"
id=
"jobform"
method=
"POST"
action=
"{{url('/admin/updateJob')}}"
enctype=
"multipart/form-data"
onsubmit=
"return validateForm()"
>
<input
type=
"hidden"
name=
"_token"
value=
"
<?=
csrf_token
();
?>
"
>
<input
type=
"hidden"
name=
"id"
value=
"{{$result->id}}"
>
<div
class=
"box-body"
>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('job_date') ? ' has-error' : '' }}"
>
<label
for=
"job_date"
>
Job Date
<span
class=
"required-title"
>
*
</span></label>
<div
class=
"input-group date"
>
<div
class=
"input-group-addon"
>
<i
class=
"fa fa-calendar"
></i>
</div>
<input
onkeydown=
"return false"
autocomplete=
"off"
class=
"form-control pull-right"
id=
"datepicker"
value=
"{{ old('job_date',$result->job_date) }}"
type=
"text"
name=
"job_date"
placeholder=
"Enter job date"
>
</div>
@if ($errors->has('job_date'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('job_date') }}
</strong>
</span>
@endif
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('job_card_no') ? ' has-error' : '' }}"
>
<label
for=
"job_card_no"
>
Job Card No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"job_card_no"
class=
"form-control required"
value=
"{{ old('job_card_no',$result->job_card_no) }}"
id=
"job_card_no"
placeholder=
"Enter job card no."
>
@if ($errors->has('job_card_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('job_card_no') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('bill_no') ? ' has-error' : '' }}"
>
<label
for=
"bill_no"
>
Bill No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"bill_no"
class=
"form-control required"
value=
"{{ old('bill_no',$result->bill_no) }}"
id=
"bill_no"
placeholder=
"Enter bill no"
>
@if ($errors->has('bill_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('bill_no') }}
</strong>
</span>
@endif
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"form-group{{ $errors->has('regn_no') ? ' has-error' : '' }}"
>
<label
for=
"regn_no"
>
Regn No.
<span
class=
"required-title"
>
*
</span></label>
<input
type=
"text"
name=
"regn_no"
class=
"form-control required"
value=
"{{ old('regn_no',$result->regn_no) }}"
id=
"regn_no"
placeholder=
"Enter regn no"
>
@if ($errors->has('regn_no'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('regn_no') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
<div
class=
"form-group{{ $errors->has('dealer_id') ? ' has-error' : '' }}"
>
<label
for=
"dealer_id"
>
Dealer
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"dealer_id"
name=
"dealer_id"
>
<option
value=
""
>
Select Dealer
</option>
@foreach($dealers as $dealer)
<option
@
if
($
result-
>
dealer_id == $dealer->dealer_id) {{ 'selected' }} @endif value="{{$dealer->dealer_id}}">{{$dealer->dealer_name}}
</option>
@endforeach
</select>
@if ($errors->has('dealer_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('dealer_id') }}
</strong>
</span>
@endif
</div>
</div>
{{--
<div
class=
"col-sm-4"
>
<div
class=
"form-group{{ $errors->has('user_id') ? ' has-error' : '' }}"
>
<label
for=
"user_id"
>
User
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"user_id"
name=
"user_id"
>
<option
value=
""
>
Select User
</option>
@foreach($users as $user)
<option
value=
"{{$user->id}}"
@
if
($
result-
>
user_id == $user->id) {{ 'selected' }} @endif>{{$user->name}} - {{get_designation_by_userid($user->id)}}
</option>
@endforeach
</select>
@if ($errors->has('user_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('user_id') }}
</strong>
</span>
@endif
</div>
</div>
--}}
<div
class=
"col-sm-4"
>
<div
class=
"form-group{{ $errors->has('model_id') ? ' has-error' : '' }}"
>
<label
for=
"model_id"
>
Model
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"model_id"
name=
"model_id"
>
<option
value=
""
>
Select Model
</option>
@foreach($result_models as $model)
<option
@
if
($
result-
>
model_id == $model->id) {{ 'selected' }} @endif value="{{ $model->id }}">{{ $model->model_name }}
</option>
@endforeach
<label
for=
"user_id"
>
User
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"user_id"
name=
"user_id"
>
<option
value=
""
>
Select User
</option>
@foreach($users as $user)
<option
value=
"{{$user->id}}"
@
if
($
result-
>
user_id == $user->id) {{ 'selected' }} @endif>{{$user->name}} - {{get_designation_by_userid($user->id)}}
</option>
@endforeach
</select>
@if ($errors->has('user_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('user_id') }}
</strong>
</span>
@endif
</div>
</div>
--}}
<div
class=
"col-sm-4"
>
<div
class=
"form-group{{ $errors->has('model_id') ? ' has-error' : '' }}"
>
<label
for=
"model_id"
>
Model
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"model_id"
name=
"model_id"
>
<option
value=
""
>
Select Model
</option>
@foreach($result_models as $model)
<option
@
if
($
result-
>
model_id == $model->id) {{ 'selected' }} @endif value="{{ $model->id }}">{{ $model->model_name }}
</option>
@endforeach
</select>
@if ($errors->has('model_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('model_id') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"form-group{{ $errors->has('advisor_id') ? ' has-error' : '' }}"
>
<label
for=
"advisor_id"
>
Advisor
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"advisor_id"
name=
"advisor_id"
>
<option
value=
""
>
Select Advisor
</option>
@foreach($advisors as $advisor)
<option
@
if
($
result-
>
advisor_id == $advisor->id) {{ 'selected' }} @endif value="{{ $advisor->id }}">{{ $advisor->name }}
</option>
@endforeach
</select>
@if ($errors->has('
model
_id'))
@if ($errors->has('
advisor
_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('model
_id') }}
</strong>
<strong>
{{ $errors->first('advisor
_id') }}
</strong>
</span>
@endif
</div>
</div>
</div>
<div
class=
"form-group{{ $errors->has('advisor_id') ? ' has-error' : '' }}"
>
<label
for=
"advisor_id"
>
Advisor
<span
class=
"required-title"
>
*
</span></label>
<select
class=
"form-control required"
id=
"advisor_id"
name=
"advisor_id"
>
<option
value=
""
>
Select Advisor
</option>
@foreach($advisors as $advisor)
<option
@
if
($
result-
>
advisor_id == $advisor->id) {{ 'selected' }} @endif value="{{ $advisor->id }}">{{ $advisor->name }}
</option>
@endforeach
</select>
@if ($errors->has('advisor_id'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('advisor_id') }}
</strong>
</span>
@endif
</div>
<table
id=
"myTable"
class=
" table order-list table-responsive"
>
<thead>
<tr>
<td>
Treatment
</td>
<td>
Job Type
</td>
<td>
Customer Price
</td>
<td>
Discount Amount
</td>
<!-- <td>Difference (+/-)</td> -->
<td>
Actual Price
</td>
{{--
<td>
Dealer Price
</td>
--}}
<td>
Power Share
</td>
{{--
<td>
Dealer Price
</td>
<table
id=
"myTable"
class=
" table order-list table-responsive"
>
<thead>
<tr>
<td>
Treatment
</td>
<td>
Job Type
</td>
<td>
Customer Price
</td>
<td>
Discount Amount
</td>
<!-- <td>Difference (+/-)</td> -->
<td>
Actual Price
</td>
{{--
<td>
Dealer Price
</td>
--}}
<td>
Power Share
</td>
{{--
<td>
Dealer Price
</td>
<td>
Incentive
</td>
--}}
</tr>
</thead>
<tbody>
@foreach($selectTreatment as $key => $value)
<tr
id=
"selectData"
>
<td
class=
"col-sm-3"
>
<select
class=
"form-control"
id=
"treatment_id{{$key}}"
name=
"treatment_id[]"
onchange=
"getAllPrice(this)"
required
>
<option
value=
""
>
Select Treatment
</option>
@foreach($treatments as $treatment)
<option
@
if
($
value
['
id
'
]=
=$treatment-
>
id) {{ 'selected' }} @endif value="{{ $treatment->id }}">{{ $treatment->treatment }}
</option>
@endforeach
</select>
</td>
<td
class=
"col-sm-2"
>
<select
class=
"form-control"
id=
"job_type{{$key}}"
name=
"job_type[]"
>
<option
value=
"5"
@
if
($
value
['
job_type
'
]=
=5)
{{
'
selected
'
}}
@
endif
>
Paid
</option>
<option
value=
"1"
@
if
($
value
['
job_type
'
]=
=1)
{{
'
selected
'
}}
@
endif
>
Free of Cost
</option>
<option
value=
"2"
@
if
($
value
['
job_type
'
]=
=2)
{{
'
selected
'
}}
@
endif
>
Demo
</option>
<option
value=
"3"
@
if
($
value
['
job_type
'
]=
=3)
{{
'
selected
'
}}
@
endif
>
Recheck
</option>
<option
value=
"4"
@
if
($
value
['
job_type
'
]=
=4)
{{
'
selected
'
}}
@
endif
>
Repeat Work
</option>
</select>
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{$value['customer_price']}}"
class=
"form-control customer{{$key}}"
name=
"customer[]"
id=
"customer{{$key}}"
readonly
/>
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{$value['difference']}}"
class=
"form-control
difference{{$key}}"
name=
"difference[]"
maxlength=
""
OnKeypress=
"return isNumber(event)"
onkeyup=
"getdifference({{$key}})"
required
/>
{{--
<input
type=
"text"
name=
"discountPrice[]"
value=
"{{$value['discountPrice']}}"
OnKeypress=
"return isNumber(event)"
onkeyup=
"getdifference({{$key}})"
class=
"form-control discountPrice{{$key}}"
required
/>
--}}
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{round($value['actualPrice'])}}"
class=
"actualP form-control actualPrice{{$key}}"
name=
"actualPrice[]"
readonly
/>
</td>
{{--
<td
class=
"col-sm-1"
>
--}}
<input
type=
"hidden"
value=
"{{round($value['dealer_price'])}}"
class=
"form-control dealerP dealerPercent{{$key}}"
id=
"dealerPercent"
name=
"dealer_price[]"
readonly
/>
{{--
</td>
--}}
<td
class=
"col-sm-1"
>
<input
type=
"text"
value=
"{{round($value['actualPrice'] - $value['dealer_price'])}}"
class=
"form-control powerShare{{$key}}"
id=
"powerShare"
name=
"power_share[]"
readonly
/>
{{--
<input
type=
"hidden"
name=
"dealer[]"
value=
"{{$value['dealer_price']}}"
class=
"form-control"
required
/>
<input
type=
"hidden"
name=
"incentive[]"
value=
"{{$value['incentive']}}"
class=
"form-control"
required
/>
--}}
<td
class=
"col-sm-2"
>
<input
type=
"button"
class=
"ibtnDel btn btn-md btn-danger"
id=
"delete-btn"
value=
"Delete"
>
</td>
</tr>
</thead>
<tbody>
@foreach($selectTreatment as $key => $value)
<tr
id=
"selectData"
>
<td
class=
"col-sm-3"
>
<select
class=
"form-control"
id=
"treatment_id{{$key}}"
name=
"treatment_id[]"
onchange=
"getAllPrice(this)"
required
>
<option
value=
""
>
Select Treatment
</option>
@foreach($treatments as $treatment)
<option
@
if
($
value
['
id
'
]=
=$treatment-
>
id) {{ 'selected' }} @endif value="{{ $treatment->id }}">{{ $treatment->treatment }}
</option>
@endforeach
</select>
</td>
<td
class=
"col-sm-2"
>
<select
class=
"form-control"
id=
"job_type{{$key}}"
name=
"job_type[]"
>
<option
value=
"5"
@
if
($
value
['
job_type
'
]=
=5)
{{
'
selected
'
}}
@
endif
>
Paid
</option>
<option
value=
"1"
@
if
($
value
['
job_type
'
]=
=1)
{{
'
selected
'
}}
@
endif
>
Free of Cost
</option>
<option
value=
"2"
@
if
($
value
['
job_type
'
]=
=2)
{{
'
selected
'
}}
@
endif
>
Demo
</option>
<option
value=
"3"
@
if
($
value
['
job_type
'
]=
=3)
{{
'
selected
'
}}
@
endif
>
Recheck
</option>
<option
value=
"4"
@
if
($
value
['
job_type
'
]=
=4)
{{
'
selected
'
}}
@
endif
>
Repeat Work
</option>
</select>
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{$value['customer_price']}}"
class=
"form-control customer{{$key}}"
name=
"customer[]"
id=
"customer{{$key}}"
readonly
/>
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{$value['difference']}}"
class=
"form-control discount
difference{{$key}}"
name=
"difference[]"
maxlength=
""
OnKeypress=
"return isNumber(event)"
onkeyup=
"getdifference({{$key}})"
required
/>
{{--
<input
type=
"text"
name=
"discountPrice[]"
value=
"{{$value['discountPrice']}}"
OnKeypress=
"return isNumber(event)"
onkeyup=
"getdifference({{$key}})"
class=
"form-control discountPrice{{$key}}"
required
/>
--}}
</td>
<td
class=
"col-sm-2"
>
<input
type=
"text"
value=
"{{round($value['actualPrice'])}}"
class=
"actualP form-control actualPrice{{$key}}"
name=
"actualPrice[]"
readonly
/>
</td>
{{--
<td
class=
"col-sm-1"
>
--}}
<input
type=
"hidden"
value=
"{{round($value['dealer_price'])}}"
class=
"form-control dealerP dealerPercent{{$key}}"
id=
"dealerPercent"
name=
"dealer_price[]"
readonly
/>
{{--
</td>
--}}
<td
class=
"col-sm-1"
>
<input
type=
"text"
value=
"{{round($value['actualPrice'] - $value['dealer_price'])}}"
class=
"form-control powerShare{{$key}}"
id=
"powerShare"
name=
"power_share[]"
readonly
/>
{{--
<input
type=
"hidden"
name=
"dealer[]"
value=
"{{$value['dealer_price']}}"
class=
"form-control"
required
/>
<input
type=
"hidden"
name=
"incentive[]"
value=
"{{$value['incentive']}}"
class=
"form-control"
required
/>
--}}
<td
class=
"col-sm-2"
>
<input
type=
"button"
class=
"ibtnDel btn btn-md btn-danger"
id=
"delete-btn"
value=
"Delete"
>
</td>
</tr>
<script>
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
1
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
2
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
3
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
4
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
{
$
(
"
.difference{{$key}}
"
).
removeAttr
(
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
();
// $(".discountPrice{{$key}}").removeAttr("disabled");
}
$
(
document
).
ready
(
function
()
{
$
(
'
#job_type{{$key}}
'
).
on
(
"
change
"
,
function
(
e
)
{
var
job_type
=
$
(
this
).
val
();
var
dealer_id
=
$
(
'
#dealer_id option:selected
'
).
val
();
var
treatment_id
=
$
(
'
#treatment_id{{$key}} option:selected
'
).
val
();
token
=
$
(
'
input[name=_token]
'
).
val
();
url
=
'
<?php
echo
url
(
"/"
);
?>
/getTreatmentPrice
'
;
data
=
{
treatment_id
:
treatment_id
,
dealer_id
:
dealer_id
,
};
if
(
this
.
value
==
1
)
{
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
1
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
2
)
{
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
2
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
3
)
{
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
3
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
4
)
{
}
else
if
(
$
(
'
#job_type{{$key}}
'
).
val
()
==
4
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
{
$
.
ajax
({
url
:
url
,
headers
:
{
'
X-CSRF-TOKEN
'
:
token
},
data
:
data
,
type
:
'
POST
'
,
datatype
:
'
JSON
'
,
success
:
function
(
resp
)
{
$
(
"
.difference{{$key}}
"
).
removeAttr
(
"
disabled
"
);
$
(
'
#customer{{$key}}
'
).
val
(
resp
.
gtp
);
$
(
'
.actualPrice{{$key}}
'
).
val
(
resp
.
gtp
);
$
(
'
.dealerPercent{{$key}}
'
).
val
(
resp
.
gdp
);
$
(
'
.powerShare{{$key}}
'
).
val
(
resp
.
gtp
-
resp
.
gdp
);
// $(".discountPrice{{$key}}").removeAttr("disabled");
}
}
else
{
$
(
"
.difference{{$key}}
"
).
removeAttr
(
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
();
// $(".discountPrice{{$key}}").removeAttr("disabled");
}
$
(
document
).
ready
(
function
()
{
$
(
'
#job_type{{$key}}
'
).
on
(
"
change
"
,
function
(
e
)
{
var
job_type
=
$
(
this
).
val
();
var
dealer_id
=
$
(
'
#dealer_id option:selected
'
).
val
();
var
treatment_id
=
$
(
'
#treatment_id{{$key}} option:selected
'
).
val
();
token
=
$
(
'
input[name=_token]
'
).
val
();
url
=
'
<?php
echo
url
(
"/"
);
?>
/getTreatmentPrice
'
;
data
=
{
treatment_id
:
treatment_id
,
dealer_id
:
dealer_id
,
};
if
(
this
.
value
==
1
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
2
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
3
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
if
(
this
.
value
==
4
)
{
$
(
"
.difference{{$key}}
"
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.dealerPercent{{$key}}
"
).
val
(
"
0
"
);
$
(
"
.powerShare{{$key}}
"
).
val
(
"
0
"
);
// $(".discountPrice{{$key}}").val("0").attr("disabled", "disabled");
}
else
{
$
.
ajax
({
url
:
url
,
headers
:
{
'
X-CSRF-TOKEN
'
:
token
},
data
:
data
,
type
:
'
POST
'
,
datatype
:
'
JSON
'
,
success
:
function
(
resp
)
{
$
(
"
.difference{{$key}}
"
).
removeAttr
(
"
disabled
"
);
$
(
'
#customer{{$key}}
'
).
val
(
resp
.
gtp
);
$
(
'
.actualPrice{{$key}}
'
).
val
(
resp
.
gtp
);
$
(
'
.dealerPercent{{$key}}
'
).
val
(
resp
.
gdp
);
$
(
'
.powerShare{{$key}}
'
).
val
(
resp
.
gtp
-
resp
.
gdp
);
// $(".discountPrice{{$key}}").removeAttr("disabled");
}
});
}
return
false
;
});
}
return
false
;
});
});
</script>
@endforeach
</tbody>
<tfoot>
</tbody>
<tfoot>
<tr>
<td
colspan=
"6"
style=
"text-align: left;"
>
<input
type=
"button"
class=
"btn btn-success btn-lg btn-block "
id=
"addrow"
value=
"Add Row"
/>
</td>
<td
colspan=
"6"
style=
"text-align: left;"
>
<input
type=
"button"
class=
"btn btn-success btn-lg btn-block "
id=
"addrow"
value=
"Add Row"
/>
</td>
</tr>
<tr>
</tr>
</tfoot>
</table>
<div
class=
"form-group"
>
<label
for=
"remark"
>
Remark
</label>
<textarea
type=
"text"
name=
"remark"
class=
"form-control required"
id=
"remark"
placeholder=
"Enter remark"
>
{{ old('remark',$result->remarks) }}
</textarea>
@if ($errors->has('remark'))
<span
class=
"help-block"
>
</tfoot>
</table>
<div
class=
"form-group"
>
<label
for=
"remark"
>
Remark
</label>
<textarea
type=
"text"
name=
"remark"
class=
"form-control required"
id=
"remark"
placeholder=
"Enter remark"
>
{{ old('remark',$result->remarks) }}
</textarea>
@if ($errors->has('remark'))
<span
class=
"help-block"
>
<strong>
{{ $errors->first('remark') }}
</strong>
</span>
@endif
</div>
<!-- <div class="form-group">
<label for="foc">Free of Cost</label>
<input type="checkbox" name="foc" @if($result->foc == 1){{'checked'}}@endif>
</div> -->
<!-- -->
{{--
<div
class=
"form-group"
>
<label
class=
"radio-inline"
for=
"paid"
>
<input
type=
"radio"
name=
"option"
value=
"5"
@
if
($
result-
>
foc_options == 5) {{'checked'}} @endif>Paid
</label>
<label
class=
"radio-inline"
for=
"foc"
>
<input
type=
"radio"
name=
"option"
value=
"1"
@
if
($
result-
>
foc_options == 1) {{'checked'}} @endif>Free of Cost
</label>
<label
class=
"radio-inline"
for=
"demo"
>
<input
type=
"radio"
name=
"option"
value=
"2"
@
if
($
result-
>
foc_options == 2) {{'checked'}} @endif>Demo
</label>
<label
class=
"radio-inline"
for=
"recheck"
>
<input
type=
"radio"
name=
"option"
value=
"3"
@
if
($
result-
>
foc_options == 3) {{'checked'}} @endif>Recheck
</label>
<label
class=
"radio-inline"
for=
"repeat"
>
<input
type=
"radio"
name=
"option"
value=
"4"
@
if
($
result-
>
foc_options == 4) {{'checked'}} @endif>Repeat Work
</label>
</div>
--}}
<div
class=
"box-footer"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Submit
</button>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script
src=
"{{asset('js/select2.full.min.js')}}"
></script>
<script
src=
"{{asset('js/bootstrap-datepicker.js')}}"
></script>
<script
type=
"text/javascript"
>
$
(
"
.select2
"
).
select2
();
$
(
'
#datepicker
'
).
datepicker
({
autoclose
:
true
,
format
:
'
yyyy-mm-dd
'
,
endDate
:
'
+0d
'
});
function
isNumber
(
evt
,
element
)
{
var
charCode
=
(
evt
.
which
)
?
evt
.
which
:
event
.
keyCode
if
(
(
charCode
!=
45
||
$
(
element
).
val
().
indexOf
(
'
-
'
)
!=
-
1
)
&&
// “-” CHECK MINUS, AND ONLY ONE.
/*(charCode != 46 || $(element).val().indexOf('.') != -1) && */
// “.” CHECK DOT, AND ONLY ONE.
(
charCode
<
48
||
charCode
>
57
))
return
false
;
else
{
return
true
;
}
</span>
@endif
</div>
<!-- <div class="form-group">
<label for="foc">Free of Cost</label>
<input type="checkbox" name="foc" @if($result->foc == 1){{'checked'}}@endif>
</div> -->
<!-- -->
{{--
<div
class=
"form-group"
>
<label
class=
"radio-inline"
for=
"paid"
>
<input
type=
"radio"
name=
"option"
value=
"5"
@
if
($
result-
>
foc_options == 5) {{'checked'}} @endif>Paid
</label>
<label
class=
"radio-inline"
for=
"foc"
>
<input
type=
"radio"
name=
"option"
value=
"1"
@
if
($
result-
>
foc_options == 1) {{'checked'}} @endif>Free of Cost
</label>
<label
class=
"radio-inline"
for=
"demo"
>
<input
type=
"radio"
name=
"option"
value=
"2"
@
if
($
result-
>
foc_options == 2) {{'checked'}} @endif>Demo
</label>
<label
class=
"radio-inline"
for=
"recheck"
>
<input
type=
"radio"
name=
"option"
value=
"3"
@
if
($
result-
>
foc_options == 3) {{'checked'}} @endif>Recheck
</label>
<label
class=
"radio-inline"
for=
"repeat"
>
<input
type=
"radio"
name=
"option"
value=
"4"
@
if
($
result-
>
foc_options == 4) {{'checked'}} @endif>Repeat Work
</label>
</div>
--}}
<div
class=
"box-footer"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Submit
</button>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script
src=
"{{asset('js/select2.full.min.js')}}"
></script>
<script
src=
"{{asset('js/bootstrap-datepicker.js')}}"
></script>
<script
type=
"text/javascript"
>
$
(
"
.select2
"
).
select2
();
$
(
'
#datepicker
'
).
datepicker
({
autoclose
:
true
,
format
:
'
yyyy-mm-dd
'
,
endDate
:
'
+0d
'
});
function
isNumber
(
evt
,
element
)
{
var
charCode
=
(
evt
.
which
)
?
evt
.
which
:
event
.
keyCode
if
(
(
charCode
!=
45
||
$
(
element
).
val
().
indexOf
(
'
-
'
)
!=
-
1
)
&&
// “-” CHECK MINUS, AND ONLY ONE.
/*(charCode != 46 || $(element).val().indexOf('.') != -1) && */
// “.” CHECK DOT, AND ONLY ONE.
(
charCode
<
48
||
charCode
>
57
))
return
false
;
else
{
return
true
;
}
}
$
(
document
).
ready
(
function
()
{
var
counter
=
<?php
echo
count
(
$selectTreatment
)
+
1
;
?>
;
$
(
"
#addrow
"
).
on
(
"
click
"
,
function
()
{
var
newRow
=
$
(
"
<tr>
"
);
var
cols
=
""
;
var
selected
=
$
(
'
#myTable
'
).
find
(
'
tbody select:first
'
).
clone
();
$
(
selected
).
find
(
'
option
'
).
removeAttr
(
'
selected
'
);
cols
+=
'
<td><select onchange="getAllPrice(this)" name="treatment_id[]" class="form-control" required>
'
+
$
(
selected
).
html
()
+
'
</select></td>
'
;
cols
+=
"
<td><select class='form-control' id='job_type
"
+
counter
+
"
' onchange='disable_func(
"
+
counter
+
"
)' name='job_type[]'><option value='5' selected>Paid</option><option value='1'>Free of Cost</option><option value='2'>Demo</option><option value='3'>Recheck</option><option value='4'>Repeat Work</option></select></td>
"
;
cols
+=
'
<td><input type="text" value="" class="form-control customer
'
+
counter
+
'
" name="customer[]" id="customer
'
+
counter
+
'
" readonly/></td>
'
;
// cols += '
<
td
><
input
type
=
"
text
"
value
=
""
class
=
"
form-control discountPrice'+counter+'
"
name
=
"
discountPrice[]
"
/><
/td>'
;
cols
+=
'
<td><input type="text" value="0" class="form-control discount difference
'
+
counter
+
'
" name="difference[]" OnKeypress="return isNumber(event)" onkeyup="getdifference(
'
+
counter
+
'
)" required/></td>
'
;
cols
+=
'
<td><input type="text" value="" class="form-control actualPrice
'
+
counter
+
'
" id="actualPrice
'
+
counter
+
'
" name="actualPrice[]" readonly/></td>
'
;
cols
+=
'
<input type="hidden" value="" class="form-control dealerP dealerPercent
'
+
counter
+
'
" id="dealerPercent
'
+
counter
+
'
" name="dealer_price[]" readonly/>
'
;
cols
+=
'
<td><input type="text" value="" class="form-control powerShare
'
+
counter
+
'
" id="powerShare
'
+
counter
+
'
" name="power_share[]" readonly/></td>
'
;
// cols += '
<
input
type
=
"
hidden
"
value
=
""
class
=
"
form-control
"
name
=
"
dealer[]
"
required
/>
'
;
// cols +=
'
<
input
type
=
"
hidden
"
value
=
""
class
=
"
form-control
"
name
=
"
incentive[]
"
required
/>
'
;
cols +=
'
<
td
><
input
type
=
"
button
"
class
=
"
ibtnDel btn btn-md btn-danger
"
id
=
"
delete-btn
"
value
=
"
Delete
"
><
/td>'
;
newRow
.
append
(
cols
);
// console.log(selected);
$
(
"
table.order-list
"
).
append
(
newRow
);
counter
++
;
});
$
(
"
table.order-list
"
).
on
(
"
click
"
,
"
.ibtnDel
"
,
function
(
event
)
{
// $(this).closest("tr").remove();
if
(
$
(
this
).
closest
(
'
tr
'
).
siblings
().
length
>
2
)
{
$
(
this
).
closest
(
'
tr
'
).
remove
();
counter
-=
1
}
$
(
document
).
ready
(
function
()
{
var
counter
=
<?php
echo
count
(
$selectTreatment
)
+
1
;
?>
;
$
(
"
#addrow
"
).
on
(
"
click
"
,
function
()
{
var
newRow
=
$
(
"
<tr>
"
);
var
cols
=
""
;
var
selected
=
$
(
'
#myTable
'
).
find
(
'
tbody select:first
'
).
clone
();
$
(
selected
).
find
(
'
option
'
).
removeAttr
(
'
selected
'
);
cols
+=
'
<td><select onchange="getAllPrice(this)" name="treatment_id[]" class="form-control" required>
'
+
$
(
selected
).
html
()
+
'
</select></td>
'
;
cols
+=
"
<td><select class='form-control' id='job_type
"
+
counter
+
"
' onchange='disable_func(
"
+
counter
+
"
)' name='job_type[]'><option value='5' selected>Paid</option><option value='1'>Free of Cost</option><option value='2'>Demo</option><option value='3'>Recheck</option><option value='4'>Repeat Work</option></select></td>
"
;
cols
+=
'
<td><input type="text" value="" class="form-control customer
'
+
counter
+
'
" name="customer[]" id="customer
'
+
counter
+
'
" readonly/></td>
'
;
// cols += '
<
td
><
input
type
=
"
text
"
value
=
""
class
=
"
form-control discountPrice'+counter+'
"
name
=
"
discountPrice[]
"
/><
/td>'
;
cols
+=
'
<td><input type="text" value="0" class="form-control difference
'
+
counter
+
'
" name="difference[]" OnKeypress="return isNumber(event)" onkeyup="getdifference(
'
+
counter
+
'
)" required/></td>
'
;
cols
+=
'
<td><input type="text" value="" class="form-control actualPrice
'
+
counter
+
'
" id="actualPrice
'
+
counter
+
'
" name="actualPrice[]" readonly/></td>
'
;
cols
+=
'
<input type="hidden" value="" class="form-control dealerP dealerPercent
'
+
counter
+
'
" id="dealerPercent
'
+
counter
+
'
" name="dealer_price[]" readonly/>
'
;
cols
+=
'
<td><input type="text" value="" class="form-control powerShare
'
+
counter
+
'
" id="powerShare
'
+
counter
+
'
" name="power_share[]" readonly/></td>
'
;
// cols += '
<
input
type
=
"
hidden
"
value
=
""
class
=
"
form-control
"
name
=
"
dealer[]
"
required
/>
'
;
// cols +=
'
<
input
type
=
"
hidden
"
value
=
""
class
=
"
form-control
"
name
=
"
incentive[]
"
required
/>
'
;
cols +=
'
<
td
><
input
type
=
"
button
"
class
=
"
ibtnDel btn btn-md btn-danger
"
id
=
"
delete-btn
"
value
=
"
Delete
"
><
/td>'
;
newRow
.
append
(
cols
);
// console.log(selected);
$
(
"
table.order-list
"
).
append
(
newRow
);
counter
++
;
});
$
(
"
table.order-list
"
).
on
(
"
click
"
,
"
.ibtnDel
"
,
function
(
event
)
{
// $(this).closest("tr").remove();
if
(
$
(
this
).
closest
(
'
tr
'
).
siblings
().
length
>
2
)
{
$
(
this
).
closest
(
'
tr
'
).
remove
();
counter
-=
1
}
});
});
function
getAllPrice
(
e
)
{
$
(
e
).
parents
(
'
tr
'
).
find
(
'
select[name^="job_type"]
'
).
val
(
"
5
"
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="difference"]
'
).
val
(
"
0
"
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="difference"]
'
).
removeAttr
(
"
disabled
"
);
var
complex
=
<?php
echo
json_encode
(
$treatments
);
?>
;
var
ids
=
$
(
e
).
val
();
var
price
=
getObjects
(
complex
,
'
id
'
,
ids
);
var
t
=
price
[
0
];
var
t
=
JSON
.
parse
(
JSON
.
stringify
(
t
));
var
c
=
$
(
e
).
attr
(
'
name
'
).
replace
(
'
name
'
,
''
);
// console.log(t.customer_price);
// $(e).parents('tr').find('input[name^="dealer"]').val(t.dealer_price);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="customer"]
'
).
val
(
t
.
customer_price
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="actualPrice"]
'
).
val
(
t
.
customer_price
);
// $(e).parents('tr').find('input[name^="dealer_price"]').val(t.dealer_price);
// $(e).parents('tr').find('input[name^="incentive"]').val(t.incentive);
var
dealer_id
=
$
(
'
#dealer_id option:selected
'
).
val
();
token
=
$
(
'
input[name=_token]
'
).
val
();
url
=
'
<?php
echo
url
(
"/"
);
?>
/getTreatmentPrice
'
;
data
=
{
treatment_id
:
ids
,
dealer_id
:
dealer_id
,
};
$
.
ajax
({
url
:
url
,
headers
:
{
'
X-CSRF-TOKEN
'
:
token
},
data
:
data
,
type
:
'
POST
'
,
datatype
:
'
JSON
'
,
success
:
function
(
resp
)
{
console
.
log
(
resp
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="dealer_price"]
'
).
val
(
resp
.
gdp
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="power_share"]
'
).
val
(
resp
.
gtp
-
resp
.
gdp
);
return
false
;
}
});
});
});
function
getAllPrice
(
e
)
{
$
(
e
).
parents
(
'
tr
'
).
find
(
'
select[name^="job_type"]
'
).
val
(
"
5
"
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="difference"]
'
).
val
(
"
0
"
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="difference"]
'
).
removeAttr
(
"
disabled
"
);
var
complex
=
<?php
echo
json_encode
(
$treatments
);
?>
;
var
ids
=
$
(
e
).
val
();
var
price
=
getObjects
(
complex
,
'
id
'
,
ids
);
var
t
=
price
[
0
];
var
t
=
JSON
.
parse
(
JSON
.
stringify
(
t
));
var
c
=
$
(
e
).
attr
(
'
name
'
).
replace
(
'
name
'
,
''
);
// console.log(t.customer_price);
// $(e).parents('tr').find('input[name^="dealer"]').val(t.dealer_price);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="customer"]
'
).
val
(
t
.
customer_price
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="actualPrice"]
'
).
val
(
t
.
customer_price
);
// $(e).parents('tr').find('input[name^="dealer_price"]').val(t.dealer_price);
// $(e).parents('tr').find('input[name^="incentive"]').val(t.incentive);
var
dealer_id
=
$
(
'
#dealer_id option:selected
'
).
val
();
token
=
$
(
'
input[name=_token]
'
).
val
();
url
=
'
<?php
echo
url
(
"/"
);
?>
/getTreatmentPrice
'
;
data
=
{
treatment_id
:
ids
,
dealer_id
:
dealer_id
,
};
$
.
ajax
({
url
:
url
,
headers
:
{
'
X-CSRF-TOKEN
'
:
token
},
data
:
data
,
type
:
'
POST
'
,
datatype
:
'
JSON
'
,
success
:
function
(
resp
)
{
console
.
log
(
resp
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="dealer_price"]
'
).
val
(
resp
.
gdp
);
$
(
e
).
parents
(
'
tr
'
).
find
(
'
input[name^="power_share"]
'
).
val
(
resp
.
gtp
-
resp
.
gdp
);
return
false
;
}
function
getObjects
(
obj
,
key
,
val
)
{
var
objects
=
[];
for
(
var
i
in
obj
)
{
if
(
!
obj
.
hasOwnProperty
(
i
))
continue
;
if
(
typeof
obj
[
i
]
==
'
object
'
)
{
objects
=
objects
.
concat
(
getObjects
(
obj
[
i
],
key
,
val
));
}
else
if
(
i
==
key
&&
obj
[
key
]
==
val
)
{
objects
.
push
(
obj
);
}
}
return
objects
;
}
function
disable_func
(
counter
)
{
// $('#job_type'+counter).on("change",function(e) {
var
job_type
=
$
(
'
#job_type
'
+
counter
).
val
();
if
(
job_type
==
1
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
2
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
3
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
4
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
{
$
(
"
.difference
"
+
counter
).
removeAttr
(
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
();
$
(
"
.powerShare
"
+
counter
).
val
();
// $(".discountPrice"+counter).removeAttr("disabled");
}
// });
}
function
calculateRow
(
row
)
{
var
customer
=
+
row
.
find
(
'
input[name^="customer"]
'
).
val
();
// var dealer = +row.find('input[name^="dealer"]').val();
// var incentive = +row.find('input[name^="incentive"]').val();
}
function
calculateGrandTotal
()
{
var
grandTotal
=
0
;
$
(
"
table.order-list
"
).
find
(
'
input[name^="customer"]
'
).
each
(
function
()
{
grandTotal
+=
+
$
(
this
).
val
();
});
// $("table.order-list").find('input[name^="dealer"]').each(function () {
// grandTotal += +$(this).val();
// });
// $("table.order-list").find('input[name^="incentive"]').each(function () {
// grandTotal += +$(this).val();
// });
$
(
"
#grandtotal
"
).
text
(
grandTotal
.
toFixed
(
2
));
}
// $('#dealer_id').on("change", function(e) {
// var dealer = $("#dealer_id").val();
// token = $('input[name=_token]').val();
// url1 = '
<?php
echo
url
(
"/"
);
?>
/getModels'
;
// url2 = '
<?php
echo
url
(
"/"
);
?>
/
getAdvisors
'
;
// url3 =
'
{{
url
(
"
admin/getdealerUsers
"
)
}}
'
;
// data = {
// dealer: dealer,
// };
// $.ajax({
// url: url1,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#model_id").html(resp);
// return false;
// }
// });
// $.ajax({
// url: url3,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#user_id").html(resp);
// return false;
// }
// });
// $.ajax({
// url: url2,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#advisor_id").html(resp);
// return false;
// }
// });
// return false;
// });
// $(
'
#
model_id
'
).on("change", function(e) {
// var dealer = $("#dealer_id").val();
// var model = $("#model_id").val();
// token = $(
'
input
[
name
=
_token
]
'
).val();
// url =
'
<?php
echo
url
(
"/"
);
?>
/
getTreatments
'
;
// data = {
// dealer: dealer,
// model: model,
// };
// $.ajax({
// url: url,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#treatment_id").html(resp);
// return false;
// }
// });
// return false;
// });
function getdifference(a) {
var d = ".difference" + a;
console.log($(d).val());
if ($(d).val() ==
''
) {
$(d).val(0);
}
var dealer_id = $(
'
#
dealer_id
option
:
selected
'
).val();
token = $(
'
input
[
name
=
_token
]
'
).val();
url =
'
<?php
echo
url
(
"/"
);
?>
/
getDealerPrice
'
;
data = {
dealer_id: dealer_id,
};
$.ajax({
url: url,
async: false,
headers: {
'
X
-
CSRF
-
TOKEN
'
: token
},
data: data,
type:
'
POST
'
,
datatype:
'
JSON
'
,
success: function(resp) {
var customer = ".customer" + a;
var actualclass = ".actualPrice" + a;
var dealerPercent = ".dealerPercent" + a;
var powerShare = ".powerShare" + a;
// var discountclass = ".discountPrice"+a;
var diff = ".difference" + a;
var actualPrice = $(actualclass).val();
var diffPrice = $(diff).val();
// var discountPrice = $(discountclass).val();
var customerPrice = $(customer).val();
// var difference = parseInt(actualPrice,10) - parseFloat(customerPrice);
// var difference = parseFloat(customerPrice) - (parseFloat(customerPrice) * parseInt(diffPrice, 10) / 100);
var difference = parseFloat(customerPrice) - parseFloat(diffPrice);
// $(diff).val(isNaN(difference)? 0 : difference.toFixed(2));
var dealerP = difference * resp/100;
var deals = difference - dealerP;
var deal = parseFloat(deals);
$(actualclass).val(isNaN(difference) ? 0 : difference.toFixed());
$(dealerPercent).val(isNaN(deal) ? 0 : deal.toFixed());
$(powerShare).val(($(actualclass).val() - $(dealerPercent).val()).toFixed(2));
}
});
}
function validateForm() {
if ($(
'
#
user_id
'
).val() ==
''
) {
alert("Please Select User");
return false;
}
}
</script>
@endsection
\ No newline at end of file
}
});
return
false
;
}
function
getObjects
(
obj
,
key
,
val
)
{
var
objects
=
[];
for
(
var
i
in
obj
)
{
if
(
!
obj
.
hasOwnProperty
(
i
))
continue
;
if
(
typeof
obj
[
i
]
==
'
object
'
)
{
objects
=
objects
.
concat
(
getObjects
(
obj
[
i
],
key
,
val
));
}
else
if
(
i
==
key
&&
obj
[
key
]
==
val
)
{
objects
.
push
(
obj
);
}
}
return
objects
;
}
function
disable_func
(
counter
)
{
// $('#job_type'+counter).on("change",function(e) {
var
job_type
=
$
(
'
#job_type
'
+
counter
).
val
();
if
(
job_type
==
1
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
2
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
3
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
if
(
job_type
==
4
)
{
$
(
"
.difference
"
+
counter
).
val
(
"
0
"
).
attr
(
"
disabled
"
,
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
(
"
0
"
);
$
(
"
.powerShare
"
+
counter
).
val
(
"
0
"
);
// $(".discountPrice"+counter).val("0").attr("disabled", "disabled");
}
else
{
$
(
"
.difference
"
+
counter
).
removeAttr
(
"
disabled
"
);
$
(
"
.actualPrice
"
+
counter
).
val
();
$
(
"
.powerShare
"
+
counter
).
val
();
// $(".discountPrice"+counter).removeAttr("disabled");
}
// });
}
function
calculateRow
(
row
)
{
var
customer
=
+
row
.
find
(
'
input[name^="customer"]
'
).
val
();
// var dealer = +row.find('input[name^="dealer"]').val();
// var incentive = +row.find('input[name^="incentive"]').val();
}
function
calculateGrandTotal
()
{
var
grandTotal
=
0
;
$
(
"
table.order-list
"
).
find
(
'
input[name^="customer"]
'
).
each
(
function
()
{
grandTotal
+=
+
$
(
this
).
val
();
});
// $("table.order-list").find('input[name^="dealer"]').each(function () {
// grandTotal += +$(this).val();
// });
// $("table.order-list").find('input[name^="incentive"]').each(function () {
// grandTotal += +$(this).val();
// });
$
(
"
#grandtotal
"
).
text
(
grandTotal
.
toFixed
(
2
));
}
// $('#dealer_id').on("change", function(e) {
// var dealer = $("#dealer_id").val();
// token = $('input[name=_token]').val();
// url1 = '
<?php
echo
url
(
"/"
);
?>
/getModels'
;
// url2 = '
<?php
echo
url
(
"/"
);
?>
/
getAdvisors
'
;
// url3 =
'
{{
url
(
"
admin/getdealerUsers
"
)
}}
'
;
// data = {
// dealer: dealer,
// };
// $.ajax({
// url: url1,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#model_id").html(resp);
// return false;
// }
// });
// $.ajax({
// url: url3,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#user_id").html(resp);
// return false;
// }
// });
// $.ajax({
// url: url2,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#advisor_id").html(resp);
// return false;
// }
// });
// return false;
// });
// $(
'
#
model_id
'
).on("change", function(e) {
// var dealer = $("#dealer_id").val();
// var model = $("#model_id").val();
// token = $(
'
input
[
name
=
_token
]
'
).val();
// url =
'
<?php
echo
url
(
"/"
);
?>
/
getTreatments
'
;
// data = {
// dealer: dealer,
// model: model,
// };
// $.ajax({
// url: url,
// headers: {
//
'
X
-
CSRF
-
TOKEN
'
: token
// },
// data: data,
// type:
'
POST
'
,
// datatype:
'
JSON
'
,
// success: function(resp) {
// $("#treatment_id").html(resp);
// return false;
// }
// });
// return false;
// });
function getdifference(a) {
var dealer_id = $(
'
#
dealer_id
option
:
selected
'
).val();
token = $(
'
input
[
name
=
_token
]
'
).val();
url =
'
<?php
echo
url
(
"/"
);
?>
/
getDealerPrice
'
;
data = {
dealer_id: dealer_id,
};
$.ajax({
url: url,
async: false,
headers: {
'
X
-
CSRF
-
TOKEN
'
: token
},
data: data,
type:
'
POST
'
,
datatype:
'
JSON
'
,
success: function(resp) {
var customer = ".customer" + a;
var actualclass = ".actualPrice" + a;
var dealerPercent = ".dealerPercent" + a;
var powerShare = ".powerShare" + a;
// var discountclass = ".discountPrice"+a;
var diff = ".difference" + a;
var actualPrice = $(actualclass).val();
var diffPrice = $(diff).val();
// var discountPrice = $(discountclass).val();
var customerPrice = $(customer).val();
// var difference = parseInt(actualPrice,10) - parseFloat(customerPrice);
// var difference = parseFloat(customerPrice) - (parseFloat(customerPrice) * parseInt(diffPrice, 10) / 100);
var actualP = parseFloat(customerPrice) - parseFloat(diffPrice);
// $(diff).val(isNaN(difference)? 0 : difference.toFixed(2));
var dealerP = customerPrice * resp / 100;
var deals = customerPrice - dealerP;
var deal = parseFloat(deals);
$(actualclass).val(isNaN(actualP) ? 0 : actualP.toFixed(2));
$(dealerPercent).val(isNaN(deal) ? 0 : deal.toFixed(2));
$(powerShare).val(($(actualclass).val() - $(dealerPercent).val()).toFixed(2));
}
});
}
function validateForm() {
if ($(
'
#
user_id
'
).val() ==
''
) {
alert("Please Select User");
return false;
}
}
</script>
@endsection
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