update level one

This commit is contained in:
Henry Jordan
2021-08-04 16:25:56 +00:00
17 changed files with 802 additions and 519 deletions

View File

@@ -60,6 +60,11 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
'APP_CUR_USER' => $user->USR_UID
]);
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
// Return with default values
return [
'DELEGATION_ID' => $faker->unique()->numberBetween(5000),
@@ -74,10 +79,10 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'foreign_keys', function
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $faker->dateTime(),
'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate,
'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_RISK_DATE' => $riskDate,
'DEL_LAST_INDEX' => 1,
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
@@ -138,7 +143,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
return [
'DEL_THREAD_STATUS' => 'OPEN',
@@ -156,7 +161,7 @@ $factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+2 day');
$finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
return [

View File

@@ -68,5 +68,9 @@
TASKS: "/home/tasks",
CATEGORIES: "/home/categories",
DEBUG_STATUS: "/home/process-debug-status?processUid={prj_uid}",
LIST_TOTAL_CASES: "/metrics/list-total-cases"
LIST_TOTAL_CASES: "/metrics/list-total-cases",
PAUSE_CASE: "/cases/{app_uid}/pause",
REASSIGN_CASE: "/cases/{app_uid}/reassign-case",
REASSIGN_USERS: "/light/userstoreassign/{task_uid}",
CATEGORIES: "/processcategory/categories"
};

View File

@@ -6,13 +6,20 @@
:style="{height: height + 'px'}"
>
<vue-card v-for="item in data" :key="item.id" :item="item" :options="options">
<slot
v-for="column in options.columns"
:name="column"
:item="item"
:column="column"
:headings="options.headings"
></slot>
<b-row>
<b-col sm="9">
<slot
v-for="column in options.columns"
:name="column"
:item="item"
:column="column"
:headings="options.headings"
></slot>
</b-col>
<b-col sm="3">
<slot name="actions"></slot>
</b-col>
</b-row>
</vue-card>
</div>

View File

@@ -6,13 +6,21 @@
:style="{height: height + 'px'}"
>
<vue-list v-for="item in data" :key="item.id" :item="item" :options="options">
<slot
v-for="column in options.columns"
:name="column"
:item="item"
:column="column"
:headings="options.headings"
></slot>
<b-row>
<b-col sm="10">
<slot
v-for="column in options.columns"
:name="column"
:item="item"
:column="column"
:headings="options.headings"
ref="containerList"
></slot>
</b-col>
<b-col sm="2">
<slot name="actions"></slot>
</b-col>
</b-row>
</vue-list>
</div>

View File

@@ -94,6 +94,7 @@ export default {
width: 0px;
z-index: 999;
display: inline-flex !important;
opacity: 1 !important;
}
.btn-outline-info {
border: none;

View File

@@ -48,10 +48,19 @@
:options="optionsVueView"
ref="vueCardView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
@@ -105,10 +114,19 @@
:options="optionsVueView"
ref="vueListView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
@@ -523,5 +541,7 @@ export default {
padding-left: 50px;
padding-right: 50px;
}
.ellipsis-container {
margin-top: 5em;
}
</style>

View File

@@ -61,10 +61,19 @@
:options="optionsVueView"
ref="vueCardView"
>
<div slot="detail" slot-scope="props">
<div @click="updateDataEllipsis(props.row)">
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
@@ -118,12 +127,21 @@
:options="optionsVueView"
ref="vueListView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<div ref="text" slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
>
@@ -608,7 +626,8 @@ export default {
display: inline-block;
}
.v-card-text {
.ellipsis-container {
margin-top: 5em;
}
.v-pm-card-info{

View File

@@ -59,10 +59,19 @@
:options="optionsVueView"
ref="vueCardView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
@@ -116,10 +125,19 @@
:options="optionsVueView"
ref="vueListView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"

View File

@@ -1,339 +1,216 @@
<template>
<div id="v-pm-charts" ref="v-pm-charts" class="v-pm-charts vp-inline-block">
<div class="p-1 v-flex">
<h6 class="v-search-title">Number of tasks per Task Status</h6>
<apexchart
v-show="typeView === 'donut'"
ref="apexchart1"
:width="width"
:options="chartOptions1"
:series="series1"
></apexchart>
<apexchart
v-show="typeView === 'bar'"
ref="apexchart2"
:width="width"
:options="chartOptions2"
:series="series2"
></apexchart>
<div class="row">
<div class="col-sm vp-center">
<button
@click="changeView('donut')"
type="button"
class="btn btn-primary"
>
<i class="fas fa-chart-pie"></i
><span class="vp-padding-l10">View</span>
</button>
</div>
<div class="col-sm">
<button
@click="changeView('bar')"
type="button"
class="btn btn-primary"
>
<i class="fas fa-chart-bar"></i
><span class="vp-padding-l10">View</span>
</button>
</div>
</div>
</div>
</div>
<div id="v-pm-charts" ref="v-pm-charts" class="v-pm-charts vp-inline-block">
<div class="p-1 v-flex">
<h6 class="v-search-title">Number of tasks per Task Status</h6>
<div>
<label class="vp-inline-block">{{ $t("ID_PROCESS_CATEGORY") }}</label>
<div class="vp-width-p40 vp-inline-block">
<multiselect
v-model="category"
:options="optionsCategory"
:searchable="false"
:close-on-select="false"
:show-labels="false"
placeholder="Pick a value"
></multiselect>
</div>
</div>
<apexchart
ref="apexchart1"
:width="width"
:options="optionsBar"
:series="seriesBar"
></apexchart>
</div>
</div>
</template>
<script>
import _ from "lodash";
import Api from "../../api/index";
import Multiselect from "vue-multiselect";
export default {
name: "VueChartLvOne",
mixins: [],
components: {},
props: [],
data() {
let that = this;
return {
typeView: "bar",
width: 0,
series1: [],
chartOptions1: {
labels: ["Team A", "Team B", "Team C", "Team D", "Team E"],
chart: {
id: "apexchart1",
type: "pie",
},
},
series2: [
{
name: "Inflation",
data: [2.3, 3.1, 4.0, 10.1, 4.0, 3.6, 3.2, 2.3, 1.4, 0.8, 0.5, 0.2],
},
],
chartOptions2: {
chart: {
id: "apexchart2",
type: "bar",
},
plotOptions: {
bar: {
borderRadius: 10,
dataLabels: {
position: "top", // top, center, bottom
},
},
},
dataLabels: {
enabled: true,
formatter: function (val) {
return val + "%";
},
offsetY: -20,
style: {
fontSize: "12px",
colors: ["#304758"],
},
},
xaxis: {
categories: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
position: "top",
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
crosshairs: {
fill: {
type: "gradient",
gradient: {
colorFrom: "#D8E3F0",
colorTo: "#BED1E6",
stops: [0, 100],
opacityFrom: 0.4,
opacityTo: 0.5,
},
},
},
tooltip: {
enabled: true,
},
},
yaxis: {
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
labels: {
show: false,
formatter: function (val) {
return val + "%";
},
},
},
title: {
text: "Monthly Inflation in Argentina, 2002",
floating: true,
offsetY: 330,
align: "center",
style: {
color: "#444",
},
},
},
};
},
created() {},
mounted() {
this.getBodyHeight();
this.getDataDonut();
this.getData();
},
watch: {},
computed: {},
updated() {},
beforeCreate() {},
methods: {
/**
* Return the height for Vue Card View body
*/
getBodyHeight() {
this.width = window.innerHeight * 0.8;
},
/**
* Change view - donut/bar
*/
changeView(view) {
this.typeView = view;
if (view == "donut") {
this.getDataDonut();
} else {
//this.getDataBar();
}
},
getDataDonut() {
this.chartOptions1 = {
labels: ["Team A", "Team B", "Team C", "Team D", "Team E"],
chart: {
id: "apexchart1",
type: "donut",
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 200,
},
legend: {
position: "bottom",
},
},
},
],
};
this.series1 = [44, 55, 41, 17, 15];
},
getDataBar() {
this.chartOptions2 = {
chart: {
id: "apexchart2",
type: "bar",
},
plotOptions: {
bar: {
borderRadius: 10,
dataLabels: {
position: "top", // top, center, bottom
},
},
},
dataLabels: {
enabled: true,
formatter: function (val) {
return val + "%";
},
offsetY: -20,
style: {
fontSize: "12px",
colors: ["#304758"],
},
},
xaxis: {
categories: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
],
position: "top",
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
crosshairs: {
fill: {
type: "gradient",
gradient: {
colorFrom: "#D8E3F0",
colorTo: "#BED1E6",
stops: [0, 100],
opacityFrom: 0.4,
opacityTo: 0.5,
},
},
},
tooltip: {
enabled: true,
},
},
yaxis: {
axisBorder: {
show: false,
},
axisTicks: {
show: false,
},
labels: {
show: false,
formatter: function (val) {
return val + "%";
},
},
},
title: {
text: "Monthly Inflation in Argentina, 2002",
floating: true,
offsetY: 330,
align: "center",
style: {
color: "#444",
},
},
};
/*
this.$apexcharts.exec("apexchart2", "updateSeries", [
{
name: "Inflation",
data: [2.3, 3.1, 4.0, 10.1, 4.0, 3.6, 3.2, 2.3, 1.4, 0.8, 0.5, 0.2],
},
]);*/
/*this.series2 = [
{
name: "Inflation",
data: [2.3, 3.1, 4.0, 10.1, 4.0, 3.6, 3.2, 2.3, 1.4, 0.8, 0.5, 0.2],
},
];*/
},
getData() {
Api.cases
.listTotalCases()
.then((response) => {
console.log("response");
console.log(response);
})
.catch((response) => {
console.log("error");
console.log(response);
});
},
},
name: "VueChartLvOne",
mixins: [],
components: {
Multiselect,
},
props: [],
data() {
let that = this;
return {
category: null,
optionsCategory: [],
width: 0,
seriesBar: [
{
data: [400, 430, 448, 470],
},
],
optionsBar: {
chart: {
type: "bar",
id: "apexchart2",
toolbar: {
show: false,
},
events: {
legendClick: function (chartContext, seriesIndex, config) {
console.log("click");
},
},
},
plotOptions: {
bar: {
barHeight: "100%",
distributed: true,
horizontal: true,
},
},
legend: {
position: "left",
offsetY: 50,
fontSize: "18px",
},
colors: ["#33b2df", "#546E7A", "#d4526e", "#13d8aa"],
dataLabels: {
enabled: false,
},
xaxis: {
categories: [
this.$i18n.t("ID_INBOX"),
this.$i18n.t("ID_DRAFT"),
this.$i18n.t("ID_PAUSED"),
this.$i18n.t("ID_UNASSIGNED"),
],
},
tooltip: {
x: {
show: false,
},
y: {
title: {
formatter: function () {
return "";
},
},
},
},
},
};
},
created() {},
mounted() {
this.getBodyHeight();
this.getCategories();
//this.getDataDonut();
//this.getData();
},
watch: {},
computed: {},
updated() {},
beforeCreate() {},
methods: {
/**
* Return the height for Vue Card View body
*/
getBodyHeight() {
this.width = window.innerHeight * 0.8;
},
/**
* Change view - donut/bar
*/
changeView(view) {
this.typeView = view;
this.getData();
},
/**
* Get data from rest API
*/
getData() {
let that = this;
Api.cases
.listTotalCases()
.then((response) => {
that.formatData(response.data);
})
.catch((response) => {});
},
/**
* Format the data for chart
*/
formatData(data) {
let l = [],
c = [],
s = [];
_.each(data, (el) => {
l.push(el["List Name"]);
s.push(el["Total"]);
if (el["Color"] == "green") {
c.push("#179a6e");
}
if (el["Color"] == "yellow") {
c.push("#feb019");
}
if (el["Color"] == "blue") {
c.push("#008ffb");
}
if (el["Color"] == "gray") {
c.push("#8f99a0");
}
});
this.seriesDonut = s;
this.seriesBar = [
{
data: s,
},
];
this.$refs["apexchart1"].updateOptions({ labels: l, colors: c });
this.$refs["apexchart2"].updateOptions({ labels: l, colors: c });
this.$apexcharts.exec("apexchart1", "updateSeries", s);
this.$apexcharts.exec("apexchart2", "updateSeries", [
{
data: s,
},
]);
},
getCategories() {
let that = this;
console.log("jonas");
Api.process
.categories({
name:""
})
.then((response) => {
that.formatDataCategories(response.data);
})
.catch((e) => {
console.error(err);
});
},
formatDataCategories(data) {
let array = [];
_.each(data, (el) => {
array.push(el["cat_name"]);
});
this.optionsCategory = array;
this.category = array[0];
},
},
};
</script>
<style>
.vp-center {
text-align: center;
.vp-task-metrics-label {
display: inline-block;
}
.vp-padding-l10 {
padding-left: 10px;
.vp-width-p40 {
width: 40%;
}
.vp-inline-block {
display: inline-block;
}
</style>
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>

View File

@@ -0,0 +1,211 @@
<template>
<div id="v-pm-charts" ref="v-pm-charts" class="v-pm-charts vp-inline-block">
<div class="p-1 v-flex">
<h6 class="v-search-title">Number of tasks per Task Status</h6>
<apexchart
v-show="typeView === 'donut'"
ref="apexchart1"
:width="width"
:options="optionsDonut"
:series="seriesDonut"
></apexchart>
<apexchart
v-show="typeView === 'bar'"
ref="apexchart2"
:width="width"
:options="optionsBar"
:series="seriesBar"
></apexchart>
<div class="row">
<div class="col-sm vp-center">
<button
@click="changeView('donut')"
type="button"
class="btn btn-primary"
>
<i class="fas fa-chart-pie"></i
><span class="vp-padding-l10">View</span>
</button>
</div>
<div class="col-sm">
<button
@click="changeView('bar')"
type="button"
class="btn btn-primary"
>
<i class="fas fa-chart-bar"></i
><span class="vp-padding-l10">View</span>
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import _ from "lodash";
import Api from "../../api/index";
export default {
name: "VueChartLvZero",
mixins: [],
components: {},
props: [],
data() {
let that = this;
return {
typeView: "bar",
width: 0,
seriesDonut: [],
optionsDonut: {
labels: [
this.$i18n.t("ID_INBOX"),
this.$i18n.t("ID_DRAFT"),
this.$i18n.t("ID_PAUSED"),
this.$i18n.t("ID_UNASSIGNED"),
],
chart: {
id: "apexchart1",
type: "donut",
},
legend: {
position: "top",
offsetY: 0,
},
},
seriesBar: [
{
data: [400, 430, 448, 470],
},
],
optionsBar: {
chart: {
type: "bar",
id: "apexchart2",
toolbar: {
show: false,
},
},
plotOptions: {
bar: {
barHeight: "100%",
distributed: true,
},
},
legend: {
position: "top",
offsetY: 0,
},
colors: ["#33b2df", "#546E7A", "#d4526e", "#13d8aa"],
dataLabels: {
enabled: false,
},
xaxis: {
categories: [
this.$i18n.t("ID_INBOX"),
this.$i18n.t("ID_DRAFT"),
this.$i18n.t("ID_PAUSED"),
this.$i18n.t("ID_UNASSIGNED"),
],
},
tooltip: {
x: {
show: false,
},
y: {
title: {
formatter: function () {
return "";
},
},
},
},
},
};
},
created() {},
mounted() {
this.getBodyHeight();
//this.getDataDonut();
this.getData();
},
watch: {},
computed: {},
updated() {},
beforeCreate() {},
methods: {
/**
* Return the height for Vue Card View body
*/
getBodyHeight() {
this.width = window.innerHeight * 0.8;
},
/**
* Change view - donut/bar
*/
changeView(view) {
this.typeView = view;
this.getData();
},
/**
* Get data from rest API
*/
getData() {
let that = this;
Api.cases
.listTotalCases()
.then((response) => {
that.formatData(response.data);
})
.catch((response) => {});
},
/**
* Format the data for chart
*/
formatData(data) {
let l = [],
c = [],
s = [];
_.each(data, (el) => {
l.push(el["List Name"]);
s.push(el["Total"]);
if (el["Color"] == "green") {
c.push("#179a6e");
}
if (el["Color"] == "yellow") {
c.push("#feb019");
}
if (el["Color"] == "blue") {
c.push("#008ffb");
}
if (el["Color"] == "gray") {
c.push("#8f99a0");
}
});
this.seriesDonut = s;
this.seriesBar = [
{
data: s,
},
];
this.$refs["apexchart1"].updateOptions({ labels: l, colors: c });
this.$refs["apexchart2"].updateOptions({ labels: l, colors: c });
this.$apexcharts.exec("apexchart1", "updateSeries", s);
this.$apexcharts.exec("apexchart2", "updateSeries", [
{
data: s,
},
]);
},
},
};
</script>
<style>
.vp-center {
text-align: center;
}
.vp-padding-l10 {
padding-left: 10px;
}
</style>

View File

@@ -9,12 +9,14 @@
</template>
<script>
import VueChartLvZero from "./VueChartLvZero.vue";
import VueChartLvOne from "./VueChartLvOne.vue";
export default {
name: "VueCharts",
mixins: [],
components: {
VueChartLvZero,
VueChartLvOne,
},
props: [],

View File

@@ -54,10 +54,19 @@
:options="optionsVueList"
ref="vueCardView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
@@ -110,10 +119,19 @@
:options="optionsVueList"
ref="vueListView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
<div slot="actions" slot-scope="props">
<b-row>
<b-col sm="12">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</b-col>
<b-col sm="12">
<div class="ellipsis-container" @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
</b-col>
</b-row>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"

View File

@@ -90,7 +90,7 @@ class EmailServerAjaxTest extends TestCase
$content = $this->requireOnceForEmailServerAjax();
$data = json_decode($content, JSON_OBJECT_AS_ARRAY);
$this->assertContains(200, $data);
$this->assertContains(500, $data);
}
/**

View File

@@ -426,6 +426,42 @@ class DelegationTest extends TestCase
$this->assertCount(1, $table->dueTo($table->DEL_TASK_DUE_DATE)->get());
}
/**
* This test scopeOnTime
*
* @covers \ProcessMaker\Model\Delegation::scopeOnTime()
* @test
*/
public function it_return_scope_on_time()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->onTime($table->DEL_DELEGATE_DATE)->get());
}
/**
* This test scopeAtRisk
*
* @covers \ProcessMaker\Model\Delegation::scopeAtRisk()
* @test
*/
public function it_return_scope_at_risk()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->atRisk($table->DEL_DELEGATE_DATE)->get());
}
/**
* This test scopeOverdue
*
* @covers \ProcessMaker\Model\Delegation::scopeOverdue()
* @test
*/
public function it_return_scope_overdue()
{
$table = factory(Delegation::class)->states('closed')->create();
$this->assertCount(1, $table->overdue($table->DEL_DELEGATE_DATE)->get());
}
/**
* This test scopeCase
*
@@ -3196,6 +3232,28 @@ class DelegationTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* This check the return of thread info
*
* @covers \ProcessMaker\Model\Delegation::getDatesFromThread()
* @test
*/
public function it_get_thread_dates()
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$task = new Task();
$taskInfo = $task->load($delegation->TAS_UID);
$taskInfo = head($taskInfo);
$taskType = $taskInfo['TAS_TYPE'];
$result = Delegation::getDatesFromThread(
$delegation->APP_UID,
$delegation->DEL_INDEX,
$delegation->TAS_UID,
$taskType
);
$this->assertNotEmpty($result);
}
/**
* This check the return of pending threads
*
@@ -3207,6 +3265,8 @@ class DelegationTest extends TestCase
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$result = Delegation::getPendingThreads($delegation->APP_NUMBER);
$this->assertNotEmpty($result);
$result = Delegation::getPendingThreads($delegation->APP_NUMBER, false);
$this->assertNotEmpty($result);
}
/**
@@ -3283,9 +3343,9 @@ class DelegationTest extends TestCase
]);
$res = Delegation::hasActiveParentsCases($parents);
// Assert the result is true
$this->assertTrue($res);
$res = Delegation::hasActiveParentsCases([]);
$this->assertFalse($res);
}
/**
@@ -3296,9 +3356,9 @@ class DelegationTest extends TestCase
*/
public function it_get_cases_completed_by_specific_user()
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$delegation = factory(Delegation::class)->states('last_thread')->create();
$result = Delegation::casesCompletedBy($delegation->USR_ID);
$this->assertEmpty($result);
$this->assertNotEmpty($result);
}
/**

View File

@@ -799,41 +799,45 @@ class Calendar extends CalendarDefinition
return $return;
}
/**
* Calculate date adding a duration, will considerate the calendar
*
* @param string $initialDate
* @param string $duration
* @param string $formatDuration
* @param array $calendarData
*
* @return string
*/
public function dashCalculateDate($initialDate, $duration, $formatDuration, $calendarData = [])
{
if (G::toUpper($formatDuration) == 'DAYS') {
$duration = $duration * $calendarData['HOURS_FOR_DAY'];
}
if (G::toUpper($formatDuration) == 'MINUTES') {
$duration = $duration / 60;
}
$hoursDuration = (float)$duration;
$newDate = $initialDate;
/**************SLA classes***************/
public function dashCalculateDate ($iniDate, $duration, $formatDuration, $calendarData = array())
{
if ( G::toUpper($formatDuration) == 'DAYS' ) {
$duration = $duration*$calendarData['HOURS_FOR_DAY'];
}
if ( G::toUpper($formatDuration) == 'MINUTES' ) {
$duration = $duration/60;
}
$hoursDuration = (float)$duration;
$newDate = $iniDate;
while ($hoursDuration > 0) {
$newDate = $this->dashGetIniDate($newDate, $calendarData);
$rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']);
$onlyDate = (date('Y-m-d',strtotime($newDate))) . ' ' . $rangeWorkHour['END'];
if ( (((float)$hoursDuration) >= ((float)$rangeWorkHour['TOTAL'])) ||
((strtotime($onlyDate) - strtotime($newDate)) < (((float)$hoursDuration)*3600))
) {
$secondRes = (float)(strtotime($onlyDate) - strtotime($newDate));
$newDate = $onlyDate;
$hoursDuration -= (float)($secondRes/3600);
} else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . round((((float)$hoursDuration)*3600), 5) . ' seconds', strtotime($newDate)));
$hoursDuration = 0;
}
}
return $newDate;
}
while ($hoursDuration > 0) {
$newDate = $this->dashGetIniDate($newDate, $calendarData);
$rangeWorkHour = $this->dashGetRangeWorkHours($newDate, $calendarData['BUSINESS_DAY']);
$onlyDate = (date('Y-m-d', strtotime($newDate))) . ' ' . $rangeWorkHour['END'];
$rangeWorkHourTotal = (float)$rangeWorkHour['TOTAL'];
if ($hoursDuration >= $rangeWorkHourTotal ||
((strtotime($onlyDate) - strtotime($newDate)) < (($hoursDuration) * 3600))
) {
$secondRes = (float)(strtotime($onlyDate) - strtotime($newDate));
$newDate = $onlyDate;
$hoursDuration -= (float)($secondRes / 3600);
} else {
$newDate = date('Y-m-d H:i:s', strtotime('+' . round((($hoursDuration) * 3600), 5) . ' seconds', strtotime($newDate)));
$hoursDuration = 0;
}
}
return $newDate;
}
//Calculate the duration betwen two dates with a calendar
public function dashCalculateDurationWithCalendar ($iniDate, $finDate = null, $calendarData = array())

View File

@@ -41,6 +41,22 @@ use ProcessMaker\Plugins\PluginRegistry;
*/
class AppDelegation extends BaseAppDelegation
{
/**
* Get the risk value
*
* @return double
*/
public function getRisk()
{
try {
$risk = 2;
return $risk;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get previous delegation (Valid Task)
*
@@ -91,42 +107,59 @@ class AppDelegation extends BaseAppDelegation
}
/**
* create an application delegation
* Create an application delegation
*
* @param $sProUid process Uid
* @param $sAppUid Application Uid
* @param $sTasUid Task Uid
* @param $sUsrUid User Uid
* @param $iPriority delegation priority
* @param $isSubprocess is a subprocess inside a process?
* @return delegation index of the application delegation.
* @param string $proUid process Uid
* @param string $appUid Application Uid
* @param string $tasUid Task Uid
* @param string $usrUid User Uid
* @param int $priority delegation priority
* @param bool $isSubprocess is a subprocess inside a process?
*
* @return int index of the application delegation.
*/
public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0, $appNumber = 0, $taskId = 0, $userId = 0, $proId = 0)
{
if (! isset($sProUid) || strlen($sProUid) == 0) {
throw (new Exception('Column "PRO_UID" cannot be null.'));
public function createAppDelegation(
$proUid,
$appUid,
$tasUid,
$usrUid,
$sAppThread,
$priority = 3,
$isSubprocess = false,
$previous = -1,
$nextTasParam = null,
$flagControl = false,
$flagControlMulInstance = false,
$delPrevious = 0,
$appNumber = 0,
$taskId = 0,
$userId = 0,
$proId = 0
){
if (! isset($proUid) || strlen($proUid) == 0) {
throw new Exception('Column "PRO_UID" cannot be null.');
}
if (! isset($sAppUid) || strlen($sAppUid) == 0) {
throw (new Exception('Column "APP_UID" cannot be null.'));
if (! isset($appUid) || strlen($appUid) == 0) {
throw new Exception('Column "APP_UID" cannot be null.');
}
if (! isset($sTasUid) || strlen($sTasUid) == 0) {
throw (new Exception('Column "TAS_UID" cannot be null.'));
if (! isset($tasUid) || strlen($tasUid) == 0) {
throw new Exception('Column "TAS_UID" cannot be null.');
}
if (! isset($sUsrUid) /*|| strlen($sUsrUid ) == 0*/) {
throw (new Exception('Column "USR_UID" cannot be null.'));
if (! isset($usrUid)) {
throw new Exception('Column "USR_UID" cannot be null.');
}
if (! isset($sAppThread) || strlen($sAppThread) == 0) {
throw (new Exception('Column "APP_THREAD" cannot be null.'));
throw new Exception('Column "APP_THREAD" cannot be null.');
}
$this->delegation_id = null;
//Get max DEL_INDEX
// Get max DEL_INDEX
$criteria = new Criteria("workflow");
$criteria->add(AppDelegationPeer::APP_UID, $sAppUid);
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
$criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
@@ -136,8 +169,8 @@ class AppDelegation extends BaseAppDelegation
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$delIndex = 1;
$delPreviusUsrUid = $sUsrUid;
$delPreviousFather = $sPrevious;
$delPreviusUsrUid = $usrUid;
$delPreviousFather = $previous;
if ($rs->next()) {
$row = $rs->getRow();
@@ -149,7 +182,7 @@ class AppDelegation extends BaseAppDelegation
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteriaDelIndex->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$criteriaDelIndex->add(AppDelegationPeer::APP_UID, $sAppUid);
$criteriaDelIndex->add(AppDelegationPeer::APP_UID, $appUid);
$criteriaDelIndex->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$rsCriteriaDelIndex = AppDelegationPeer::doSelectRS($criteriaDelIndex);
@@ -161,23 +194,23 @@ class AppDelegation extends BaseAppDelegation
$delIndex = (isset($row["DEL_INDEX"]))? $row["DEL_INDEX"] + 1 : 1;
}
}
//Verify successors: parrallel submit in the same time
// Verify successors: parallel submit in the same time
if ($flagControl) {
$nextTaskUid = $sTasUid;
$index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $sAppUid, $delPreviousFather);
if ($this->createThread($index, $sAppUid)) {
$nextTaskUid = $tasUid;
$index = $this->getAllTasksBeforeSecJoin($nextTaskUid, $appUid, $delPreviousFather);
if ($this->createThread($index, $appUid)) {
return 0;
}
}
if ($flagControlMulInstance) {
$nextTaskUid = $sTasUid;
$index = $this->getAllTheardMultipleInstance($delPreviousFather, $sAppUid);
if ($this->createThread($index, $sAppUid, $sUsrUid)) {
$nextTaskUid = $tasUid;
$index = $this->getAllTheardMultipleInstance($delPreviousFather, $appUid);
if ($this->createThread($index, $appUid, $usrUid)) {
return 0;
}
}
//Update set
// Update set
$criteriaUpdate = new Criteria('workflow');
$criteriaUpdate->add(AppDelegationPeer::DEL_LAST_INDEX, 0);
BasePeer::doUpdate($criteria, $criteriaUpdate, Propel::getConnection('workflow'));
@@ -185,15 +218,15 @@ class AppDelegation extends BaseAppDelegation
// Define the status of the thread, if is subprocess we need to CLOSED the thread
$theadStatus = !$isSubprocess ? 'OPEN' : 'CLOSED';
$this->setAppUid($sAppUid);
$this->setProUid($sProUid);
$this->setTasUid($sTasUid);
$this->setAppUid($appUid);
$this->setProUid($proUid);
$this->setTasUid($tasUid);
$this->setDelIndex($delIndex);
$this->setDelLastIndex(1);
$this->setDelPrevious($sPrevious == - 1 ? 0 : $sPrevious);
$this->setUsrUid($sUsrUid);
$this->setDelPrevious($previous == - 1 ? 0 : $previous);
$this->setUsrUid($usrUid);
$this->setDelType('NORMAL');
$this->setDelPriority(($iPriority != '' ? $iPriority : '3'));
$this->setDelPriority(($priority != '' ? $priority : '3'));
$this->setDelThread($sAppThread);
$this->setDelThreadStatus($theadStatus);
$this->setDelThreadStatusId(Delegation::$thread_status[$theadStatus]);
@@ -203,24 +236,22 @@ class AppDelegation extends BaseAppDelegation
$this->setUsrId($userId);
$this->setProId($proId);
//The function return an array now. By JHL
$delTaskDueDate = $this->calculateDueDate($sNextTasParam);
$delRiskDate = $this->calculateRiskDate($sNextTasParam, $this->getRisk());
//$this->setDelTaskDueDate( $delTaskDueDate['DUE_DATE'] ); // Due date formatted
// The function return an array now. By JHL
$delTaskDueDate = $this->calculateDueDate($nextTasParam);
$delRiskDate = $this->calculateRiskDate($nextTasParam, $this->getRisk());
$this->setDelTaskDueDate($delTaskDueDate);
$this->setDelRiskDate($delRiskDate);
if ((defined("DEBUG_CALENDAR_LOG")) && (DEBUG_CALENDAR_LOG)) {
//$this->setDelData( $delTaskDueDate['DUE_DATE_LOG'] ); // Log of actions made by Calendar Engine
// Log of actions made by Calendar Engine
$this->setDelData($delTaskDueDate);
} else {
$this->setDelData('');
}
// this condition assures that an internal delegation like a subprocess dont have an initial date setted
// This condition assures that an internal delegation like a subprocess don't have an initial date set
if ($delIndex == 1 && ! $isSubprocess) {
//the first delegation, init date this should be now for draft applications, in other cases, should be null.
// The first delegation, init date this should be now for draft applications, in other cases, should be null.
$this->setDelInitDate('now');
}
@@ -247,16 +278,16 @@ class AppDelegation extends BaseAppDelegation
$bpmn = new \ProcessMaker\Project\Bpmn();
$flagActionsByEmail = true;
$arrayAppDelegationPrevious = $this->getPreviousDelegationValidTask($sAppUid, $delIndex);
$arrayAppDelegationPrevious = $this->getPreviousDelegationValidTask($appUid, $delIndex);
$data = new stdclass();
$data->TAS_UID = $sTasUid;
$data->APP_UID = $sAppUid;
$data->TAS_UID = $tasUid;
$data->APP_UID = $appUid;
$data->DEL_INDEX = $delIndex;
$data->USR_UID = $sUsrUid;
$data->USR_UID = $usrUid;
$data->PREVIOUS_USR_UID = ($arrayAppDelegationPrevious !== false)? $arrayAppDelegationPrevious['USR_UID'] : $delPreviusUsrUid;
if ($bpmn->exists($sProUid)) {
if ($bpmn->exists($proUid)) {
/*----------------------------------********---------------------------------*/
// this section evaluates the actions by email trigger execution please
// modify this section carefully, the if evaluation checks if the license has been
@@ -265,8 +296,8 @@ class AppDelegation extends BaseAppDelegation
::getSingleton()
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
$criteriaAbe = new Criteria();
$criteriaAbe->add(AbeConfigurationPeer::PRO_UID, $sProUid);
$criteriaAbe->add(AbeConfigurationPeer::TAS_UID, $sTasUid);
$criteriaAbe->add(AbeConfigurationPeer::PRO_UID, $proUid);
$criteriaAbe->add(AbeConfigurationPeer::TAS_UID, $tasUid);
$resultAbe = AbeConfigurationPeer::doSelectRS($criteriaAbe);
$resultAbe->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($resultAbe->next()) {
@@ -289,7 +320,7 @@ class AppDelegation extends BaseAppDelegation
$pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$Pmgmail->gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess);
$Pmgmail->gmailsForRouting($usrUid, $tasUid, $appUid, $delIndex, $isSubprocess);
}
} catch (Exception $oError) {
error_log($oError->getMessage());
@@ -299,8 +330,8 @@ class AppDelegation extends BaseAppDelegation
}
if ($flagActionsByEmail) {
$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
$pluginRegistry = PluginRegistry::loadSingleton();
$pluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
}
}
@@ -474,30 +505,38 @@ class AppDelegation extends BaseAppDelegation
//Calendar - Use the dates class to calculate dates
$calendar = new Calendar();
$arrayCalendarData = $calendar->getCalendarData($aCalendarUID);
$calendarData = $calendar->getCalendarData($aCalendarUID);
if ($calendar->pmCalendarUid == "") {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
$calendarData = $calendar->getCalendarData();
}
//Due date
$initDate = $this->getDelDelegateDate();
$timeZone = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($initDate);
$dueDate = $calendar->dashCalculateDate($timeZone, $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData);
$dueDate = $calendar->dashCalculateDate($timeZone, $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $calendarData);
$dueDate = \ProcessMaker\Util\DateTime::convertDataToUtc($dueDate);
return $dueDate;
}
public function calculateRiskDate($dueDate, $risk)
/**
* Calculate the risk date
*
* @param array $nextTask
* @param double $risk
*
* @return string
*/
public function calculateRiskDate($nextTask, $risk)
{
try {
$data = array();
if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
$data['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION'];
$data['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT'];
$data = [];
if (isset($nextTask['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $nextTask['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') {
$data['TAS_DURATION'] = $nextTask['NEXT_TASK']['TAS_DURATION'];
$data['TAS_TIMEUNIT'] = $nextTask['NEXT_TASK']['TAS_TIMEUNIT'];
} else {
$task = TaskPeer::retrieveByPK($this->getTasUid());
$data['TAS_DURATION'] = $task->getTasDuration();
@@ -506,19 +545,21 @@ class AppDelegation extends BaseAppDelegation
$riskTime = $data['TAS_DURATION'] - ($data['TAS_DURATION'] * $risk);
//Calendar - Use the dates class to calculate dates
// Calendar - Use the dates class to calculate dates
$calendar = new Calendar();
$arrayCalendarData = array();
if ($calendar->pmCalendarUid == "") {
$calendarData = [];
if (empty($calendar->pmCalendarUid)) {
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
$arrayCalendarData = $calendar->getCalendarData();
$calendarData = $calendar->getCalendarData();
}
//Risk date
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $riskTime, $data['TAS_TIMEUNIT'], $arrayCalendarData);
// Risk date
$riskDate = $calendar->dashCalculateDate(
$this->getDelDelegateDate(),
$riskTime,
$data['TAS_TIMEUNIT'],
$calendarData
);
return $riskDate;
} catch (Exception $e) {
@@ -526,12 +567,6 @@ class AppDelegation extends BaseAppDelegation
}
}
public function getDiffDate($date1, $date2)
{
return ($date1 - $date2) / (24 * 60 * 60); //days
return ($date1 - $date2) / 3600;
}
//usually this function is called when routing in the flow, so by default cron =0
public function calculateDuration($cron = 0)
{
@@ -799,8 +834,10 @@ class AppDelegation extends BaseAppDelegation
/**
* This function get the current user related to the specific case and index
*
* @param string $appUid, Uid related to the case
* @param integer $index, Index to review
*
* @return array
*/
public static function getCurrentUsers($appUid, $index)
@@ -820,7 +857,8 @@ class AppDelegation extends BaseAppDelegation
/**
* Verify if the current case is already routed.
*
* @param string $AppUid the uid of the application
* @param string $appUid the uid of the application
*
* @return array $Fields the fields
*/
@@ -841,18 +879,6 @@ class AppDelegation extends BaseAppDelegation
}
}
public function getRisk()
{
try {
$risk = 0.2;
//Return
return $risk;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get all task before Join Threads
*

View File

@@ -381,36 +381,39 @@ class Delegation extends Model
* Scope a query to get only the date on time
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeOnTime($query)
public function scopeOnTime($query, $now)
{
return $query->whereRaw('TIMEDIFF(DEL_RISK_DATE, NOW()) > 0');
return $query->where('DEL_RISK_DATE', '>', $now);
}
/**
* Scope a query to get only the date at risk
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeAtRisk($query)
public function scopeAtRisk($query, $now)
{
return $query->whereRaw('TIMEDIFF(DEL_RISK_DATE, NOW()) < 0 AND TIMEDIFF(DEL_TASK_DUE_DATE, NOW()) > 0');
return $query->where('DEL_RISK_DATE', '>=', $now)->where('DEL_TASK_DUE_DATE', '>=', $now);
}
/**
* Scope a query to get only the date overdue
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $now
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeOverdue($query)
public function scopeOverdue($query, $now)
{
return $query->whereRaw('TIMEDIFF(DEL_TASK_DUE_DATE, NOW()) < 0');
return $query->where('DEL_TASK_DUE_DATE', '>', $now);
}
/**