Merge branch 'main' of http://192.168.1.200:3000/Stratawiz/Rapport-Laravel
Specific Folder FTP Upload / ftp-deploy (push) Successful in 33s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 33s
Details
This commit is contained in:
commit
86205f226c
|
|
@ -3,24 +3,27 @@
|
|||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{ URL::asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/downloaddata?form_id={{$form_id}}" class="btn btn-info btn-xs float-end">Download Data</a>
|
||||
<a href="/form/downloaddata?form_id={{$form_id}}" id="download-btn" class="btn btn-info btn-xs float-end">Download</a>
|
||||
<button type="button" id="emailme" class="btn btn-warning btn-xs float-end me-2">Email</button>
|
||||
</div>
|
||||
<div class="col-12 p-2">
|
||||
<p>Showing data for last 30 days, please download data if you want to see all submissions</p>
|
||||
<div class="col-12">
|
||||
<p>Showing data for last 30 days, please use above button "Download" to download all submissions</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
|
@ -35,70 +38,73 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<div id="notifications"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="row row-cols-lg-auto g-2 align-items-center mb-3" id="date-range-form" onsubmit="return false;">
|
||||
<div class="col-4">
|
||||
<label for="startdate" class="form-label mb-0 me-2">Start Date:</label>
|
||||
<input type="date" class="form-control form-control-sm d-inline-block w-auto" id="startdate" name="startdate" value="{{ request()->input('startdate') }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label for="enddate" class="form-label mb-0 me-2">End Date:</label>
|
||||
<input type="date" class="form-control form-control-sm d-inline-block w-auto" id="enddate" name="enddate" value="{{ request()->input('enddate') }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" class="btn btn-primary btn-sm" id="apply-date-range">Apply</button>
|
||||
</div>
|
||||
<input type="hidden" name="form_id" id="form_id" value="{{ $form_id }}">
|
||||
</form>
|
||||
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<table id="basic-datatable" class="table dt-responsive nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
<th data-priority="1" colspan="2">Submitted By</th>
|
||||
@foreach($questions as $code => $question)
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
<th data-priority="1">Submitted By</th>
|
||||
<th data-priority="1">Employee Code</th>
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
<th data-priority="1">Workflow Status</th>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue
|
||||
@endif
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
<th data-priority="1">{{$v}} ({{$question->label}})</th>
|
||||
@endforeach
|
||||
@else
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
@if(isset($submission->user_info->name))
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime(isset($submission->record_date) ? $submission->record_date : $submission->updatedAt))}}</th>
|
||||
<th>
|
||||
<img src="{{isset($submission->user_info->avatar) ? $submission->user_info->avatar : 'https://ui-avatars.com/api/?background=random&name='.$submission->user_info->name}}" class="rounded-circle avatar-sm" />
|
||||
</th>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{$submission->user_info->name}}</h5>
|
||||
<p class="mb-0 text-muted"><small>{{$submission->user_info->designation}}</small></p>
|
||||
</td>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" download="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
@if( in_array('edit', $submission->actions) )
|
||||
<a href="/form/edit?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</button>
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
@if($lastkey)
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-info" type="button" id="load-btn"> Load More ... </button>
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
|
|
@ -118,26 +124,325 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{ URL::asset('assets/libs/datatables/datatables.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.btn-primary').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
})
|
||||
var lastkey = '{{$lastkey}}';
|
||||
$('#load-btn').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
$.get( "/form/loadmore?lastkey=" + lastkey, function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
lastkey = data.lastkey;
|
||||
$( "#tech-companies-1 tbody" ).append( data.html );
|
||||
if(!data.lastkey) {
|
||||
$('#load-btn').hide()
|
||||
$.fn.dataTable.ext.errMode = 'none';
|
||||
|
||||
const loggedInUser = @json($formdata->user_id ?? "");
|
||||
const allAccess = @json(isset($formdata->all_data_access) ? $formdata->all_data_access : 0);
|
||||
const formId = @json($form_id);
|
||||
|
||||
let table = $('#basic-datatable').DataTable({
|
||||
"responsive": false,
|
||||
"language": {
|
||||
"paginate": {
|
||||
"previous": "<i class='mdi mdi-chevron-left'>",
|
||||
"next": "<i class='mdi mdi-chevron-right'>"
|
||||
}
|
||||
},
|
||||
fixedHeader: true,
|
||||
"paging": false,
|
||||
"pageLength": -1,
|
||||
"lengthMenu": [[-1], ["All"]],
|
||||
'processing': false,
|
||||
'serverSide': false,
|
||||
"order": [[1, "desc"]],
|
||||
'searching': true,
|
||||
'info': true,
|
||||
data: [],
|
||||
columns: [
|
||||
{ data: null,
|
||||
render: function ( data, type, row ) {
|
||||
let buttons = '';
|
||||
if (row.actions && Array.isArray(row.actions)) {
|
||||
if (row.actions.includes('edit')) {
|
||||
buttons += ` <button title="Edit" class="btn btn-warning btn-xs waves-effect waves-light btn-edit" submission="${row.submission_id}"><i class="mdi mdi-pencil-outline"></i></button>`;
|
||||
}
|
||||
if (row.actions.includes('delete') {{ isset($formdata->all_data_access) && $formdata->all_data_access ? ' || true' : '' }} ) {
|
||||
buttons += ` <button title="Delete" class="btn btn-danger btn-xs waves-effect waves-light btn-delete" submission="${row.submission_id}"><i class="mdi mdi-delete-outline"></i></button>`;
|
||||
}
|
||||
|
||||
if (row.actions.includes('approve') || row.actions.includes('reject')) {
|
||||
const nextApprover = row.workflow_next_approver ?? "";
|
||||
|
||||
if (allAccess == 1) {
|
||||
if (row.actions.includes('approve')) {
|
||||
buttons += `<button title="Approve" class="btn btn-success btn-xs waves-effect waves-light btn-approve" submission="${row.submission_id}"><i class="mdi mdi-check-outline"></i></button>`;
|
||||
}
|
||||
if (row.actions.includes('reject')) {
|
||||
buttons += `<button title="Reject" class="btn btn-danger btn-xs waves-effect waves-light btn-reject" submission="${row.submission_id}"><i class="mdi mdi-close-outline"></i></button>`;
|
||||
}
|
||||
} else if (loggedInUser === nextApprover) {
|
||||
if (row.actions.includes('approve')) {
|
||||
buttons += `<button title="Approve" class="btn btn-success btn-xs waves-effect waves-light btn-approve" submission="${row.submission_id}"><i class="mdi mdi-check-outline"></i></button>`;
|
||||
}
|
||||
if (row.actions.includes('reject')) {
|
||||
buttons += `<button title="Reject" class="btn btn-danger btn-xs waves-effect waves-light btn-reject" submission="${row.submission_id}"><i class="mdi mdi-close-outline"></i></button>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
},
|
||||
{ "data": "date" },
|
||||
{ "data": "name" },
|
||||
{ "data": "employee_code" },
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
{ "data": "workflow_status" },
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue
|
||||
@endif
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach($question->options as $k => $v)
|
||||
{ "data": "{{$k}}" },
|
||||
@endforeach
|
||||
@elseif($question->type == 'image')
|
||||
{
|
||||
"data": "{{$code}}",
|
||||
render: function(data, type, row) {
|
||||
data = row.{{$code.'_file'}};
|
||||
if (data && !/^https?:\/\//.test(data)) {
|
||||
data = '{{ env('AWS_URL') }}' + (data.startsWith('/') ? '' : '/') + data;
|
||||
}
|
||||
if (data && data !== '') {
|
||||
return '<button class="btn btn-info btn-xs" onclick="window.open(\'' + data + '\', \'_blank\')">View Image</button>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
@elseif($question->type == 'file')
|
||||
{
|
||||
"data": "{{$code}}",
|
||||
render: function(data, type, row) {
|
||||
data = row.{{$code.'_file'}};
|
||||
if (data && !/^https?:\/\//.test(data)) {
|
||||
data = '{{ env('AWS_URL') }}' + (data.startsWith('/') ? '' : '/') + data;
|
||||
}
|
||||
if (data && data !== '') {
|
||||
return '<a class="btn btn-primary btn-xs" target="_blank" href="' + data + '" download>Download File</a>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
@else
|
||||
{ "data": "{{$code}}" },
|
||||
@endif
|
||||
@endforeach
|
||||
],
|
||||
"initComplete": function(settings, json) {
|
||||
var api = this.api();
|
||||
var textBox = $('.dataTables_filter label input');
|
||||
textBox.unbind();
|
||||
textBox.bind('keyup input', function(e) {
|
||||
if(e.keyCode == 8 && !textBox.val() || e.keyCode == 46 && !textBox.val()) {
|
||||
// do nothing
|
||||
} else if(e.keyCode == 13 || !textBox.val()) {
|
||||
api.search(this.value).draw();
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
let lastkey = '{{$lastkey}}';
|
||||
|
||||
function bindRowActions() {
|
||||
$('.btn-edit').off('click').on('click', function(){
|
||||
window.location.href = '/form/edit?id=' + $(this).attr('submission');
|
||||
});
|
||||
|
||||
$('.btn-delete').off('click').on('click', function(){
|
||||
const btn = $(this);
|
||||
const submissionId = btn.attr('submission');
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Do you really want to delete this submission?",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#d33',
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Yes, delete it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
url: '/form/delete',
|
||||
type: 'GET',
|
||||
data: {
|
||||
id: submissionId,
|
||||
form_id: formId,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
$("#pageloader").fadeOut();
|
||||
if (response.success) {
|
||||
Swal.fire('Deleted!', 'Submission has been deleted.', 'success');
|
||||
table.rows(function(idx, data) {
|
||||
return data.submission_id === submissionId;
|
||||
}).remove().draw();
|
||||
} else {
|
||||
Swal.fire('Error!', response.message || 'Could not delete submission.', 'error');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire('Error!', xhr.responseJSON?.message || 'Could not delete submission.', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-approve').off('click').on('click', function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=approve&id=' + that.attr('submission') + '&form_id=' + formId,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
that.parent().html('');
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire('Error!', 'Could not approve submission.', 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-reject').off('click').on('click', function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=reject&id=' + that.attr('submission') + '&form_id=' + formId,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
that.parent().html('');
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire('Error!', 'Could not reject submission.', 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadRows(lastkeyVal, append = true, extraParams = {}) {
|
||||
$("#pageloader").fadeIn();
|
||||
|
||||
let params = {
|
||||
lastkey: lastkeyVal,
|
||||
partition: '{{ $formdata->partition ?? '' }}',
|
||||
limit: 50
|
||||
};
|
||||
@if(isset($formdata->all_data_access) && $formdata->all_data_access == 1)
|
||||
params['alldata'] = 1;
|
||||
@else
|
||||
params['user_id'] = '{{ $formdata->user_id ?? '' }}';
|
||||
params['team_report'] = 1;
|
||||
@endif
|
||||
|
||||
params = Object.assign(params, extraParams);
|
||||
|
||||
$.get('/form/loadmore?' + $.param(params), function(data) {
|
||||
$("#pageloader").fadeOut();
|
||||
if (data && data.rows && data.rows.length > 0) {
|
||||
if (append) {
|
||||
table.rows.add(data.rows).draw(false);
|
||||
} else {
|
||||
table.clear().rows.add(data.rows).draw();
|
||||
}
|
||||
lastkey = data.lastkey;
|
||||
if (!data.lastkey) {
|
||||
$('#load-btn').hide();
|
||||
} else {
|
||||
$('#load-btn').show();
|
||||
}
|
||||
} else if (!append) {
|
||||
table.clear().draw();
|
||||
$('#load-btn').hide();
|
||||
} else {
|
||||
$('#load-btn').hide();
|
||||
}
|
||||
|
||||
bindRowActions();
|
||||
}).fail(function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire('Error!', 'Could not load submissions.', 'error');
|
||||
});
|
||||
}
|
||||
|
||||
let currentFilterParams = {};
|
||||
|
||||
$('#apply-date-range').on('click', function() {
|
||||
currentFilterParams = {
|
||||
form_id: $('#form_id').val(),
|
||||
startdate: $('#startdate').val(),
|
||||
enddate: $('#enddate').val()
|
||||
};
|
||||
lastkey = 1;
|
||||
loadRows(lastkey, false, currentFilterParams);
|
||||
});
|
||||
|
||||
currentFilterParams = {
|
||||
form_id: $('#form_id').val(),
|
||||
startdate: $('#startdate').val(),
|
||||
enddate: $('#enddate').val()
|
||||
};
|
||||
loadRows(1, false, currentFilterParams);
|
||||
|
||||
$('#load-btn').off('click').on('click', function() {
|
||||
if (lastkey) {
|
||||
loadRows(lastkey, true, currentFilterParams);
|
||||
}
|
||||
});
|
||||
|
||||
$('.btn-primary').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
});
|
||||
|
||||
$('#emailme').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
var startdate = $('#startdate').val() || '';
|
||||
var enddate = $('#enddate').val() || '';
|
||||
var url = '/form/downloaddata?email=1&form_id=' + encodeURIComponent(formId);
|
||||
if (startdate) url += '&startdate=' + encodeURIComponent(startdate);
|
||||
if (enddate) url += '&enddate=' + encodeURIComponent(enddate);
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
success: function() {
|
||||
$('#notifications').append('<div class="alert alert-success">Email Sent Successfully</div>');
|
||||
$("#pageloader").fadeOut();
|
||||
},
|
||||
error: function() {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire('Error!', 'Could not send email.', 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#startdate, #enddate').on('change', function(){
|
||||
var startdate = $('#startdate').val() || '';
|
||||
var enddate = $('#enddate').val() || '';
|
||||
var url = '/form/downloaddata?form_id=' + encodeURIComponent(formId);
|
||||
if (startdate) url += '&startdate=' + encodeURIComponent(startdate);
|
||||
if (enddate) url += '&enddate=' + encodeURIComponent(enddate);
|
||||
$('#download-btn').attr('href', url);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,627 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="{{ in_array($question->code, ['upload-supporting-doc1', 'upload-supporting-doc2']) ? 'upload-doc-fields' : '' }} col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
<input class="form-check-input" type="radio" name="{{$question->code}}" id="field-{{$question->code}}_{{$option->value}}" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="field-{{$question->code}}_{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radiometrix')
|
||||
@php
|
||||
// Decode the first option's value to use as heading labels
|
||||
$headings =
|
||||
count($question->options) > 0
|
||||
? json_decode($question->options[0]->value)
|
||||
: [];
|
||||
@endphp
|
||||
|
||||
{{-- Matrix Wrapper with Horizontal Scroll on Small Screens --}}
|
||||
<div class="table-responsive">
|
||||
<div class="d-table w-100">
|
||||
{{-- Table Headers --}}
|
||||
<div class="d-table-row font-weight-bold">
|
||||
<div class="d-table-cell p-2" style="width: 150px;"></div>
|
||||
{{-- Placeholder for row labels --}}
|
||||
@foreach ($headings as $head)
|
||||
<div class="d-table-cell text-center p-2">{{ $head }}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- Table Rows --}}
|
||||
@foreach ($question->options as $option)
|
||||
@php $nn = json_decode($option->value); @endphp
|
||||
<div class="d-table-row align-middle">
|
||||
<div class="d-table-cell font-weight-bold p-2"
|
||||
style="width: 150px;">
|
||||
{{ $option->display }}
|
||||
</div>
|
||||
|
||||
@foreach ($nn as $value)
|
||||
<div class="d-table-cell text-center p-2">
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary ms-2">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
|
||||
<input
|
||||
type="file"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
accept=".jpg,.jpeg,.pdf,image/*"
|
||||
capture="environment"
|
||||
{{$question->required == 'yes'?'required':'' }}>
|
||||
|
||||
@elseif(isset($question->value))
|
||||
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
.form-label {
|
||||
font-weight:bold;
|
||||
font-size:16px;
|
||||
}
|
||||
.upload-doc-fields {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
@php
|
||||
$doctors = [];
|
||||
foreach($questions as $question) {
|
||||
if($question->code == 'contact_id') {
|
||||
$doctors = $question->options;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
var allDoctors = {!! json_encode($doctors) !!};
|
||||
console.log("INITIAL DOCTORS FROM BACKEND", allDoctors);
|
||||
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy=all',
|
||||
// success: function(data) {
|
||||
|
||||
// console.log("FULL DATA", data);
|
||||
|
||||
// if(data.length > 0){
|
||||
// console.log("FIRST DOCTOR", data[0]);
|
||||
// }
|
||||
|
||||
// window.allDoctors = data;
|
||||
// allDoctors = data;
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-select-category').on('change', function () {
|
||||
|
||||
console.log("CATEGORY CHANGED");
|
||||
|
||||
console.log("Selected Category:", $(this).val());
|
||||
|
||||
console.log("All Doctors:", allDoctors);
|
||||
|
||||
const mandatoryDoctorCount = {
|
||||
|
||||
"foracort-ciphaler": 10,
|
||||
"duolin-synchrobreathe": 10,
|
||||
"foracort-g": 10,
|
||||
"pedia": 5,
|
||||
"triple-combination-voltido-trio-indaflo-g": 10,
|
||||
"ics-laba-seroflo-maxiflo-voltido": 10,
|
||||
"competition-dr": 20
|
||||
|
||||
};
|
||||
|
||||
let selectedCategory = $(this).val();
|
||||
|
||||
$('#field-contact_id').html('');
|
||||
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value",'')
|
||||
.text('-- Select --')
|
||||
);
|
||||
|
||||
if(allDoctors.length === 0) {
|
||||
|
||||
console.log("Doctors array empty");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let filteredDoctors = allDoctors.filter(function(doc){
|
||||
|
||||
if(!doc.contact){
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert category slug
|
||||
let categoryKey = selectedCategory
|
||||
.replace(/-/g, '_');
|
||||
|
||||
console.log("Checking:", categoryKey, doc.contact[categoryKey]);
|
||||
|
||||
return doc.contact[categoryKey] === 'yes';
|
||||
|
||||
});
|
||||
|
||||
console.log("Filtered Doctors:", filteredDoctors);
|
||||
console.log(filteredDoctors);
|
||||
let requiredCount = mandatoryDoctorCount[selectedCategory] || 0;
|
||||
if(filteredDoctors.length < requiredCount){
|
||||
|
||||
let categoryName = $('#field-select-category option:selected').text();
|
||||
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: 'Incomplete Tagging',
|
||||
text: `Tagging for ${categoryName} is incomplete. Please complete tagging through My Doctors.`
|
||||
});
|
||||
|
||||
// reset category dropdown
|
||||
$('#field-select-category').val('');
|
||||
|
||||
// reset doctor dropdown
|
||||
$('#field-contact_id').html('');
|
||||
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value",'')
|
||||
.text('-- Select --')
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
filteredDoctors.forEach(function(itm){
|
||||
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value", itm.value)
|
||||
.attr("doctor_category", itm.doctor_category)
|
||||
.attr("msl_code", itm.msl_code)
|
||||
.attr("speciality", itm.speciality)
|
||||
.text(itm.display)
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// const categoryMetricMap = {
|
||||
|
||||
// "Foracort Ciphaler":
|
||||
// "doctor_converion_Foracort_Ciphaler",
|
||||
|
||||
// "Duolin Synchrobreathe":
|
||||
// "doctor_converion_Duolin_Synchrobreathe",
|
||||
|
||||
// "Foracort G":
|
||||
// "doctor_converion_Foracort_G",
|
||||
|
||||
// "Pedia":
|
||||
// "doctor_converion_Pedia",
|
||||
|
||||
// "Triple combination (Voltido Trio/ Indaflo G)":
|
||||
// "doctor_converion_Triple_combination_(Voltido_Trio/_Indaflo_G)",
|
||||
|
||||
// "ICS LABA (Seroflo Maxiflo Voltido)":
|
||||
// "doctor_converion_ICS_LABA_(Seroflo_Maxiflo_Voltido)"
|
||||
// };
|
||||
|
||||
|
||||
// $('#field-select-category').on('change', function () {
|
||||
|
||||
// $('#report-form input.dynamic-hidden').remove();
|
||||
|
||||
// // Convert value to slug
|
||||
// let slug = $(this).val()
|
||||
// .toLowerCase()
|
||||
// .trim()
|
||||
// .replace(/[^a-z0-9\s-]/g, '') // remove special chars
|
||||
// .replace(/\s+/g, '_') // spaces to underscore
|
||||
// .replace(/-+/g, '_'); // hyphen to underscore
|
||||
|
||||
// $('#report-form').append(
|
||||
// '<input type="hidden" class="dynamic-hidden" name="' + slug + '" value="1">'
|
||||
// );
|
||||
// });
|
||||
|
||||
// $('#field-converted').on('change', function () {
|
||||
// let value = $(this).val();
|
||||
// console.log(value);
|
||||
// $('#report-form input.dynamic-hidden').remove();
|
||||
|
||||
// // Convert value to slug
|
||||
// let slug = $(this).val()
|
||||
// .toLowerCase()
|
||||
// .trim()
|
||||
// .replace(/[^a-z0-9\s-]/g, '') // remove special chars
|
||||
// .replace(/\s+/g, '_') // spaces to underscore
|
||||
// .replace(/-+/g, '_'); // hyphen to underscore
|
||||
|
||||
// if(value === 'Yes') {
|
||||
// $('#report-form').append(
|
||||
// '<input type="hidden" class="dynamic-hidden" name="' + slug + '" value="1">'
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
function appendConvertedField() {
|
||||
|
||||
// remove old hidden fields
|
||||
$('#report-form input.converted-hidden').remove();
|
||||
|
||||
let convertedValue = $('#field-converted').val();
|
||||
|
||||
let selectedCategory = $('#field-select-category').val();
|
||||
|
||||
if(!convertedValue || !selectedCategory){
|
||||
return;
|
||||
}
|
||||
|
||||
// category mapping
|
||||
let categoryMap = {
|
||||
|
||||
"foracort-ciphaler": "foracort_ciphaler",
|
||||
"duolin-synchrobreathe": "duolin_synchrobreathe",
|
||||
"foracort-g": "foracort_g",
|
||||
"pedia": "pedia",
|
||||
"triple-combination-voltido-trio-indaflo-g": "triple_combination_voltido_trio_indaflo_g",
|
||||
"ics-laba-seroflo-maxiflo-voltido": "ics_laba_seroflo_maxiflo_voltido",
|
||||
"competition-dr": "competition_dr"
|
||||
|
||||
};
|
||||
|
||||
let categoryKey = categoryMap[selectedCategory];
|
||||
|
||||
if(!categoryKey){
|
||||
return;
|
||||
}
|
||||
|
||||
// category data
|
||||
let categoryValue = (convertedValue === 'Yes') ? '1' : '0';
|
||||
|
||||
// append original category field
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="converted-hidden" name="' + categoryKey + '" value="' + categoryValue + '">'
|
||||
);
|
||||
|
||||
// extra metric fields
|
||||
if(convertedValue === 'Yes'){
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="converted-hidden" name="conversion_yes" value="1">'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if(convertedValue === 'No'){
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="converted-hidden" name="conversion_no" value="1">'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
console.log("Category:", categoryKey, categoryValue);
|
||||
|
||||
}
|
||||
|
||||
$('#field-converted').on('change', appendConvertedField);
|
||||
|
||||
$('#field-select-category').on('change', appendConvertedField);
|
||||
|
||||
|
||||
|
||||
function toggleUploadFields() {
|
||||
|
||||
let value = $('#field-converted').val();
|
||||
|
||||
console.log(value);
|
||||
|
||||
if (value === 'Yes') {
|
||||
|
||||
$('.upload-doc-fields').show();
|
||||
|
||||
// make upload mandatory
|
||||
$('#field-upload-supporting-doc1').prop('required', true);
|
||||
|
||||
} else {
|
||||
|
||||
$('.upload-doc-fields').hide();
|
||||
|
||||
// remove mandatory validation
|
||||
$('#field-upload-supporting-doc1').prop('required', false);
|
||||
|
||||
// optional cleanup
|
||||
$('#field-upload-supporting-doc1').val('');
|
||||
$('#field-upload-supporting-doc2').val('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// hide initially always
|
||||
$('.upload-doc-fields').css('display', 'none');
|
||||
|
||||
|
||||
// run after small delay so dropdown is fully rendered
|
||||
setTimeout(function () {
|
||||
|
||||
toggleUploadFields();
|
||||
|
||||
}, 200);
|
||||
|
||||
|
||||
// initial hide/show
|
||||
toggleUploadFields();
|
||||
|
||||
|
||||
// dropdown change
|
||||
$(document).on('change', '#field-converted', function () {
|
||||
|
||||
toggleUploadFields();
|
||||
|
||||
if ($(this).val() === 'No') {
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#submit-btn').offset().top
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// $(document).on('change', '#field-converted', function () {
|
||||
// let converted = $(this).val();
|
||||
// if (converted == 'No') {
|
||||
// $('.metric-field-wrapper').hide();
|
||||
// } else {
|
||||
// $('.metric-field-wrapper').show();
|
||||
// incrementMetric();
|
||||
// }
|
||||
// });
|
||||
|
||||
// function incrementMetric() {
|
||||
// let category = $('#field-select-category').val();
|
||||
// let metricField = categoryMetricMap[category];
|
||||
// if (!metricField) {
|
||||
// return;
|
||||
// }
|
||||
// let selector = '#field-' + metricField;
|
||||
// let currentVal = parseInt($(selector).val()) || 0;
|
||||
// $(selector).val(currentVal + 1);
|
||||
// }
|
||||
|
||||
$('input[type="file"]').on('change', function () {
|
||||
let file = this.files[0];
|
||||
if (!file) return;
|
||||
let allowedTypes = [
|
||||
'image/jpeg',
|
||||
'image/jpg',
|
||||
'application/pdf'
|
||||
|
||||
];
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Only JPG and PDF files are allowed.');
|
||||
$(this).val('');
|
||||
}
|
||||
|
||||
});
|
||||
@if($id)
|
||||
setTimeout(function () {
|
||||
console.log("EDIT MODE TRIGGERED");
|
||||
$('#field-select-category').trigger('change');
|
||||
}, 300);
|
||||
@endif
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
console.log(allDoctors);
|
||||
console.log(data);
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com':'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('input[type="date"]').attr(
|
||||
'max',
|
||||
new Date().toISOString().split("T")[0]
|
||||
);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -73,13 +73,24 @@
|
|||
value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:0}}"
|
||||
{{ $question->code == 'total_lobg_rx' ? 'readonly' : '' }}>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="9999999999"
|
||||
step="1"
|
||||
|
||||
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
|
||||
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
|
||||
{{ in_array($question->code, ['total_lobg_rx']) ? 'readonly' : '' }}
|
||||
|
||||
value="{{isset($question->value)?$question->value:0}}">
|
||||
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
|
|
@ -284,41 +295,67 @@
|
|||
|
||||
|
||||
|
||||
$("#field-contact_id").change(function(){
|
||||
$(document).on('change', '#field-contact_id', function () {
|
||||
|
||||
let selected = $('option:selected', this);
|
||||
let selected = $(this).find('option:selected');
|
||||
|
||||
console.log(selected.attr('msl_code'));
|
||||
console.log(selected.attr('speciality'));
|
||||
$('#field-msl_code').val(
|
||||
selected.attr('msl_code') || ''
|
||||
);
|
||||
|
||||
$('#field-msl_code').val(selected.attr('msl_code'));
|
||||
$('#field-speciality').val(selected.attr('speciality'));
|
||||
$('#field-speciality').val(
|
||||
selected.attr('speciality') || ''
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Auto populate Total LOBG Rx from LO-BG 0.5 mg Rx
|
||||
|
||||
function calculateTotalLOBGRx() {
|
||||
// LOBG auto fill
|
||||
|
||||
let loBgRx = parseFloat($('#field-lo_bg_05_mg_rx').val()) || 0;
|
||||
function syncLOBGTotal() {
|
||||
|
||||
$('#field-total_lobg_rx').val(loBgRx);
|
||||
}
|
||||
let loBgRx = parseInt(
|
||||
$('#field-lo_bg_05_mg_rx').val()
|
||||
) || 0;
|
||||
|
||||
// Trigger on typing/change
|
||||
$('#field-lo_bg_05_mg_rx').on('keyup change', function () {
|
||||
calculateTotalLOBGRx();
|
||||
});
|
||||
// integer only
|
||||
$('#field-lo_bg_05_mg_rx').val(loBgRx);
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
// autofill total
|
||||
$('#field-total_lobg_rx').val(loBgRx);
|
||||
}
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
// trigger while typing
|
||||
|
||||
$(document).on(
|
||||
'input keyup change',
|
||||
'#field-lo_bg_05_mg_rx',
|
||||
function () {
|
||||
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
|
||||
syncLOBGTotal();
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// prevent future dates
|
||||
|
||||
$('input[type="date"]').attr(
|
||||
'max',
|
||||
new Date().toISOString().split("T")[0]
|
||||
);
|
||||
|
||||
|
||||
// initial load sync
|
||||
|
||||
syncLOBGTotal();
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -44,18 +44,7 @@
|
|||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
|
|
@ -68,24 +57,31 @@
|
|||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}
|
||||
{{ in_array($question->code, ['msl-code', 'speciality']) ? 'readonly' : '' }}
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
|
||||
<input
|
||||
type="{{$question->type}}"
|
||||
type="number"
|
||||
min="0"
|
||||
max="9999999999"
|
||||
step="1"
|
||||
|
||||
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
|
||||
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
{{$question->required == 'yes'?'required':'' }}
|
||||
|
||||
{{$question->code == 'msl_code' ? 'readonly' : ''}}
|
||||
value="{{isset($question->value)?$question->value:0}}"
|
||||
|
||||
{{$question->code == 'speciality' ? 'readonly' : ''}}
|
||||
{{ $question->code == 'total-ziten-rx' ? 'readonly' : '' }}>
|
||||
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
|
|
@ -234,40 +230,17 @@
|
|||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append(
|
||||
$("<option></option>")
|
||||
.attr("value", itm.value)
|
||||
.attr("msl_code", itm.msl_code)
|
||||
.attr("speciality", itm.speciality)
|
||||
.text(itm.display)
|
||||
|
||||
|
||||
); }
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
$("#field-contact_id").change(function(){
|
||||
let selected = $('option:selected', this);
|
||||
$('#field-msl_code').val(selected.attr('msl_code'));
|
||||
$('#field-speciality').val(selected.attr('speciality'));
|
||||
});
|
||||
$(document).on(
|
||||
'input',
|
||||
'#field-ziten-m-20-mg-1000-mg-rx, #field-ziten-m-20-mg-500-mg-rx, #field-ziten-rx',
|
||||
function () {
|
||||
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$(document).on('change', '#field-contact_id', function () {
|
||||
|
|
@ -346,15 +319,12 @@
|
|||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
$('input[type="date"]').attr(
|
||||
'max',
|
||||
new Date().toISOString().split("T")[0]
|
||||
);
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -13,17 +13,32 @@
|
|||
@php
|
||||
$brandData = [
|
||||
|
||||
['brand'=>'CELOL', 'slug'=>'celol_units','pseudoId'=>'celol_value','slug2'=>'celol2'],
|
||||
/*['brand'=>'CELOL', 'slug'=>'celol_units','pseudoId'=>'celol_value','slug2'=>'celol2'],
|
||||
['brand'=>'Denmab', 'slug'=>'denmab_units','pseudoId'=>'denmab_value','slug2'=>'denmab2'],
|
||||
['brand'=>'Emanzen', 'slug'=>'emanzen_units','pseudoId'=>'emanzen_value','slug2'=>'emanzen2'],
|
||||
['brand'=>'Ferium XT', 'slug'=>'ferium_xt_units','pseudoId'=>'ferium_xt_value','slug2'=>'ferium_xt2'],
|
||||
['brand'=>'Fitjoint', 'slug'=>'fitjoint_units','pseudoId'=>'fitjoint_value','slug2'=>'fitjoint2'],
|
||||
['brand'=>'Galact Granules', 'slug'=>'galact_granules_units','pseudoId'=>'galact_granules_value','slug2'=>'galact_granules2'],
|
||||
['brand'=>'Infen P', 'slug'=>'infen_p_units','pseudoId'=>'infen_p_value','slug2'=>'infen_p2'],
|
||||
['brand'=>'Osteri', 'slug'=>'osteri_units','pseudoId'=>'osteri_value','slug2'=>'osteri2'],
|
||||
['brand'=>'Proxym', 'slug'=>'proxym_units','pseudoId'=>'proxym_value','slug2'=>'proxym2'],
|
||||
['brand'=>'Ferium Injection', 'slug'=>'ferium_injection_units','pseudoId'=>'ferium_injection_value','slug2'=>'ferium_injection2'],
|
||||
|
||||
|
||||
*/
|
||||
['brand'=>'Galact Granules', 'slug'=>'galact_granules_units','pseudoId'=>'galact_granules_value','slug2'=>'galact_granules2'],
|
||||
['brand'=>'Sylate', 'slug'=>'sylate_units','pseudoId'=>'sylate_value','slug2'=>'sylate2'],
|
||||
['brand'=>'OROFER FCM INJECTION 1K', 'slug'=>'orofer_fcm_injection_1k_units','pseudoId'=>'orofer_fcm_injection_1k_value','slug2'=>'orofer_fcm_injection_1k2'],
|
||||
['brand'=>'OROFER FCM INJECTION 750 MG / 15 ML', 'slug'=>'orofer_fcm_injection_750_mg_15_ml_units','pseudoId'=>'orofer_fcm_injection_750_mg_15_ml_value','slug2'=>'orofer_fcm_injection_750_mg_15_ml2'],
|
||||
['brand'=>'OROFER FCM INJECTION 500 MG / 10 ML', 'slug'=>'orofer_fcm_injection_500_mg_10_ml_units','pseudoId'=>'orofer_fcm_injection_500_mg_10_ml_value','slug2'=>'orofer_fcm_injection_500_mg_10_ml2'],
|
||||
['brand'=>'Reludro', 'slug'=>'reludro_units','pseudoId'=>'reludro_value','slug2'=>'reludro_2'],
|
||||
['brand'=>'Femzact', 'slug'=>'femzact_units','pseudoId'=>'femzact_value','slug2'=>'femzact_2'],
|
||||
|
||||
['brand'=>'Sylate Inj', 'slug'=>'sylate_inj_units','pseudoId'=>'sylate_inj_value','slug2'=>'sylate_inj_2'],
|
||||
['brand'=>'Sylate T 500', 'slug'=>'sylate_t_500_units','pseudoId'=>'sylate_t_500_value','slug2'=>'sylate_t_500_2'],
|
||||
['brand'=>'Sylate 500', 'slug'=>'sylate_500_units','pseudoId'=>'sylate_500_value','slug2'=>'sylate_500_2'],
|
||||
['brand'=>'Sylate 250', 'slug'=>'sylate_250_units','pseudoId'=>'sylate_250_value','slug2'=>'sylate_250_2'],
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
|
@ -289,7 +304,7 @@ $brandData = [
|
|||
$('#field-record_date').val(record_date.toISOString().split('T')[0])
|
||||
})
|
||||
|
||||
$('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units')
|
||||
/* $('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units,#field-orofer_fcm_injection_1k_units,#field-orofer_fcm_injection_750_mg_15_ml_units,#field-orofer_fcm_injection_500_mg_10_ml_units,#field-reludro_units,#field-femzact_units')
|
||||
.on('input', function() {
|
||||
let a = parseFloat($('#field-celol_units').val()) || 0;
|
||||
let priceOfA = 215;
|
||||
|
|
@ -345,10 +360,38 @@ $brandData = [
|
|||
let priceOfK = 353;
|
||||
let productOfK = (k * priceOfK).toFixed(2);
|
||||
$('#field-sylate_value').val(productOfK);
|
||||
})
|
||||
|
||||
|
||||
$('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units')
|
||||
let l = parseFloat($('#field-orofer_fcm_injection_1k_units').val()) || 0;
|
||||
let priceOfL = 2250;
|
||||
let productOfL = (l * priceOfL).toFixed(2);
|
||||
$('#field-orofer_fcm_injection_1k_value').val(productOfL);
|
||||
|
||||
let m = parseFloat($('#field-orofer_fcm_injection_750_mg_15_ml_units').val()) || 0;
|
||||
let priceOfM = 1160;
|
||||
let productOfM = (m * priceOfM).toFixed(2);
|
||||
$('#field-orofer_fcm_injection_750_mg_15_ml_value').val(productOfM);
|
||||
|
||||
let n = parseFloat($('#field-orofer_fcm_injection_500_mg_10_ml_units').val()) || 0;
|
||||
let priceOfN = 1115;
|
||||
let productOfN = (n * priceOfN).toFixed(2);
|
||||
$('#field-orofer_fcm_injection_500_mg_10_ml_value').val(productOfN);
|
||||
|
||||
let o = parseFloat($('#field-reludro_units').val()) || 0;
|
||||
let priceOfO = 480;
|
||||
let productOfO = (o * priceOfO).toFixed(2);
|
||||
$('#field-reludro_value').val(productOfO);
|
||||
|
||||
let p = parseFloat($('#field-femzact_units').val()) || 0;
|
||||
let priceOfP = 152.23;
|
||||
let productOfP = (p * priceOfP).toFixed(2);
|
||||
$('#field-femzact_value').val(productOfP);
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units,#field-orofer_fcm_injection_1k_units,#field-orofer_fcm_injection_750_mg_15_ml_units,#field-orofer_fcm_injection_500_mg_10_ml_units,#field-reludro_units,#field-femzact_units')
|
||||
.on('input', function() {
|
||||
let a = parseInt($('#field-celol_value').val()) || 0;
|
||||
let b = parseInt($('#field-denmab_value').val()) || 0;
|
||||
|
|
@ -362,10 +405,152 @@ $brandData = [
|
|||
let i= parseInt($('#field-osteri_value').val()) ||0;
|
||||
let j= parseInt($('#field-ferium_injection_value').val()) ||0;
|
||||
let k= parseInt($('#field-sylate_value').val()) ||0;
|
||||
let l= parseInt($('#field-orofer_fcm_injection_1k_value').val()) ||0;
|
||||
let m= parseInt($('#field-orofer_fcm_injection_750_mg_15_ml_value').val()) ||0;
|
||||
let n= parseInt($('#field-orofer_fcm_injection_500_mg_10_ml_value').val()) ||0;
|
||||
let o= parseInt($('#field-reludro_value').val()) ||0;
|
||||
let p= parseInt($('#field-femzact_value').val()) ||0;
|
||||
|
||||
let total = (a + b + c + d + e + f + g + h + i + j + k).toFixed(2);
|
||||
|
||||
|
||||
let total = (a + b + c + d + e + f + g + h + i + j + k+l+m+n+o+p).toFixed(2);
|
||||
$('#field-total_pob_in_strips').val(total);
|
||||
})
|
||||
}) */
|
||||
|
||||
|
||||
const products = [
|
||||
{
|
||||
unit: '#field-celol_units',
|
||||
value: '#field-celol_value',
|
||||
price: 215
|
||||
},
|
||||
{
|
||||
unit: '#field-denmab_units',
|
||||
value: '#field-denmab_value',
|
||||
price: 4465
|
||||
},
|
||||
{
|
||||
unit: '#field-emanzen_units',
|
||||
value: '#field-emanzen_value',
|
||||
price: 164
|
||||
},
|
||||
{
|
||||
unit: '#field-ferium_xt_units',
|
||||
value: '#field-ferium_xt_value',
|
||||
price: 218
|
||||
},
|
||||
{
|
||||
unit: '#field-fitjoint_units',
|
||||
value: '#field-fitjoint_value',
|
||||
price: 553
|
||||
},
|
||||
{
|
||||
unit: '#field-galact_granules_units',
|
||||
value: '#field-galact_granules_value',
|
||||
price: 513.60
|
||||
},
|
||||
{
|
||||
unit: '#field-infen_p_units',
|
||||
value: '#field-infen_p_value',
|
||||
price: 112
|
||||
},
|
||||
{
|
||||
unit: '#field-osteri_units',
|
||||
value: '#field-osteri_value',
|
||||
price: 3186
|
||||
},
|
||||
{
|
||||
unit: '#field-proxym_units',
|
||||
value: '#field-proxym_value',
|
||||
price: 274
|
||||
},
|
||||
{
|
||||
unit: '#field-ferium_injection_units',
|
||||
value: '#field-ferium_injection_value',
|
||||
price: 1200
|
||||
},
|
||||
{
|
||||
unit: '#field-sylate_units',
|
||||
value: '#field-sylate_value',
|
||||
price: 353
|
||||
},
|
||||
{
|
||||
unit: '#field-orofer_fcm_injection_1k_units',
|
||||
value: '#field-orofer_fcm_injection_1k_value',
|
||||
price: 2250
|
||||
},
|
||||
{
|
||||
unit: '#field-orofer_fcm_injection_750_mg_15_ml_units',
|
||||
value: '#field-orofer_fcm_injection_750_mg_15_ml_value',
|
||||
price: 1160
|
||||
},
|
||||
{
|
||||
unit: '#field-orofer_fcm_injection_500_mg_10_ml_units',
|
||||
value: '#field-orofer_fcm_injection_500_mg_10_ml_value',
|
||||
price: 1115
|
||||
},
|
||||
{
|
||||
unit: '#field-reludro_units',
|
||||
value: '#field-reludro_value',
|
||||
price: 480
|
||||
},
|
||||
{
|
||||
unit: '#field-femzact_units',
|
||||
value: '#field-femzact_value',
|
||||
price: 152.23
|
||||
},
|
||||
|
||||
{
|
||||
unit: '#field-sylate_inj_units',
|
||||
value: '#field-sylate_inj_value',
|
||||
price: 80.74
|
||||
},
|
||||
|
||||
{
|
||||
unit: '#field-sylate_t_500_units',
|
||||
value: '#field-sylate_t_500_value',
|
||||
price: 388.22
|
||||
},
|
||||
|
||||
{
|
||||
unit: '#field-sylate_500_units',
|
||||
value: '#field-sylate_500_value',
|
||||
price: 337.78
|
||||
},
|
||||
|
||||
{
|
||||
unit: '#field-sylate_250_units',
|
||||
value: '#field-sylate_250_value',
|
||||
price: 175.85
|
||||
}
|
||||
];
|
||||
|
||||
// Create selector string
|
||||
const selectors = products.map(p => p.unit).join(',');
|
||||
|
||||
// Single event
|
||||
$(selectors).on('input', function () {
|
||||
|
||||
let total = 0;
|
||||
|
||||
products.forEach(product => {
|
||||
|
||||
let units = parseFloat($(product.unit).val()) || 0;
|
||||
|
||||
let value = (units * product.price).toFixed(2);
|
||||
|
||||
$(product.value).val(value);
|
||||
|
||||
total += parseFloat(value);
|
||||
|
||||
});
|
||||
|
||||
$('#field-total_pob_in_strips').val(total.toFixed(2));
|
||||
|
||||
});
|
||||
|
||||
$('#field-total_pob_in_strips').prop('readonly',true);
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -414,55 +599,6 @@ $brandData = [
|
|||
});
|
||||
|
||||
|
||||
const brandSku = document.querySelector('label[for="field-brand_sku"]');
|
||||
const heading = document.querySelector('#heading');
|
||||
const totalPOB = document.querySelector('#field-total_pob_in_strips');
|
||||
const celol1 = document.querySelector("#field_celol1");
|
||||
const celol2 = document.querySelector("#field_celol2");
|
||||
const celol3 = document.querySelector("#field_celol3");
|
||||
const celol4 = document.querySelector('#field_celol4');
|
||||
const denmab = document.querySelector('#field_denmab');
|
||||
const emanzen1 = document.querySelector('#field_emanzen1');
|
||||
const emanzen2 = document.querySelector('#field_emanzen2');
|
||||
const emanzen3 = document.querySelector('#field_emanzen3');
|
||||
const emanzen4 = document.querySelector('#field_emanzen4');
|
||||
const emdydro1 = document.querySelector('#field_emdydro1');
|
||||
const emdydro2 = document.querySelector('#field_emdydro2');
|
||||
const emdydro3 = document.querySelector('#field_emhydro3');
|
||||
const ferium1 = document.querySelector('#field_ferium1');
|
||||
const ferium2 = document.querySelector('#field_ferium2');
|
||||
const ferium3 = document.querySelector("#field_ferium3")
|
||||
const ferium4 = document.querySelector("#field_ferium4");
|
||||
const ferium5 = document.querySelector("#field_ferium5");
|
||||
const ferium6 = document.querySelector('#field_ferium6');
|
||||
const ferium7 = document.querySelector("#field_ferium7")
|
||||
const ferium8 = document.querySelector("#field_ferium8");
|
||||
const ferium9 = document.querySelector("#field_ferium9");
|
||||
const fitjoint1 = document.querySelector("#field_fitjoint1");
|
||||
const fitjoint2 = document.querySelector('#field_fitjoint2');
|
||||
const galact1 = document.querySelector("#field_galact1")
|
||||
const galact2 = document.querySelector("#field_galact2");
|
||||
const galact3 = document.querySelector("#field_galact3");
|
||||
const galact4 = document.querySelector('#field_galact4');
|
||||
const infen1 = document.querySelector("#field_infen1")
|
||||
const infen2 = document.querySelector("#field_infen2");
|
||||
const osteri1 = document.querySelector("#field_osteri1");
|
||||
const osteri2 = document.querySelector('#field_osteri2');
|
||||
const panpure = document.querySelector("#field_panpure1")
|
||||
const proxym1 = document.querySelector("#field_proxym1");
|
||||
const proxym2 = document.querySelector("#field_proxym2");
|
||||
const proxym3 = document.querySelector('#field_proxym3');
|
||||
const proxym4 = document.querySelector("#field_proxym4")
|
||||
const proxym5 = document.querySelector("#field_proxym5");
|
||||
const proxym6 = document.querySelector("#field_proxym6");
|
||||
const proxym7 = document.querySelector('#field_proxym7');
|
||||
const proxym8 = document.querySelector("#field_proxym8")
|
||||
const proxym9 = document.querySelector("#field_proxym9");
|
||||
const sylate1 = document.querySelector("#field_sylate1");
|
||||
const sylate2 = document.querySelector('#field_sylate2');
|
||||
const sylate3 = document.querySelector("#field_sylate3");
|
||||
const sylate4 = document.querySelector('#field_sylate4');
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -231,6 +231,34 @@
|
|||
$('#field-total_galact_pob_value').val(total);
|
||||
})
|
||||
|
||||
|
||||
$('#field-orofer_fcm_injection_1k_pob_value,#field-orofer_fcm_injection_750_mg_15_ml_pob_value,#field-orofer_fcm_injection_500_mg_10_ml_pob_value,#field-total_orofer_fcm_value').prop('readonly',true);
|
||||
|
||||
|
||||
$('#field-orofer_fcm_injection_1k_no_of_strips,#field-orofer_fcm_injection_750_mg_15_ml_no_of_strips,#field-orofer_fcm_injection_500_mg_10_ml_no_of_strips').on('keyup',function(){
|
||||
let a=parseFloat($('#field-orofer_fcm_injection_1k_no_of_strips').val()||0);
|
||||
let b=parseFloat($('#field-orofer_fcm_injection_750_mg_15_ml_no_of_strips').val()||0);
|
||||
let c=parseFloat($('#field-orofer_fcm_injection_500_mg_10_ml_no_of_strips').val()||0);
|
||||
|
||||
let priceOfA=2250;
|
||||
let priceOfB=1160;
|
||||
let priceOfC=1115;
|
||||
|
||||
let productOfA=a*priceOfA;
|
||||
let productOfB=b*priceOfB;
|
||||
let productOfC=c*priceOfC;
|
||||
|
||||
$('#field-orofer_fcm_injection_1k_pob_value').val(productOfA);
|
||||
$('#field-orofer_fcm_injection_750_mg_15_ml_pob_value').val(productOfB);
|
||||
$('#field-orofer_fcm_injection_500_mg_10_ml_pob_value').val(productOfC);
|
||||
|
||||
let total=parseFloat(productOfA+productOfB+productOfC);
|
||||
|
||||
$('#field-total_orofer_fcm_value').val(total);
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
Loading…
Reference in New Issue