Merge branch 'main' of http://192.168.1.200:3000/Stratawiz/Rapport-Laravel
Specific Folder FTP Upload / ftp-deploy (push) Successful in 32s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 32s
Details
This commit is contained in:
commit
49394e5d21
|
|
@ -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>
|
||||
|
|
@ -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