-
-
-
-
+
+
+ There was an error loading data for the job "{{ currentJob.metadata.client.name }}".
+
Please try again later.
+
+
+
+
+
+
+
+
+
+
+ Hello! Rules list updated. Do you want to check?
+
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
@@ -152,7 +142,7 @@
- Flag rule {{currentFlaggingRule.name}}
+ Flag rule {{ currentFlaggingRule.name }}
@@ -160,9 +150,9 @@
-
+
@@ -172,8 +162,8 @@
+ :class="{ 'opacity-25': flagRuleForm.processing }"
+ :disabled="flagRuleForm.processing">
Flag
@@ -194,11 +184,13 @@ import JetDialogModal from '@/Jetstream/DialogModal';
import JetInput from '@/Jetstream/Input'
import JetLabel from '@/Jetstream/Label'
import JetSecondaryButton from '@/Jetstream/SecondaryButton'
+import Loader from "@/Components/Loader";
import ViewRule from '@/Components/PM/Rules/ViewRule'
import ViewRuleItem from "@/Components/PM/Rules/ViewRuleItem";
import JobSearch from "@/Components/OP/JobSearchForm";
import isotope from 'vueisotope'
import moment from "moment";
+import JobIdentification from "@/Components/OP/JobIdentification";
export default {
props: [
@@ -210,9 +202,11 @@ export default {
data() {
return {
+ currentJob: this.job,
+ currentRules: this.rules,
searchJobKey: this.jobNumber,
searching: false,
- searchedRules: [..._.orderBy(this.rules, 'created_at', 'desc')],
+ searchedRules: [this.currentRules],
isOpen: false,
currentRule: null,
rulesUpdated: false,
@@ -246,42 +240,96 @@ export default {
this.rulesUpdated = true;
});
}
+ },
+
+ jobNumber: function (newJobNumber, oldJobNumber) {
+ console.log('detected job number change');
+ this.initJobLoaded();
}
},
created() {
- this.searchedRules.forEach(rule => {
- rule.terms.forEach(term => {
- if (term.taxonomy.parent.name === 'Job Categorizations') {
- if (!this.taxonomies.includes(term.taxonomy.name)) {
- this.taxonomies.push(term.taxonomy.name);
- }
+ },
- if (this.rulesByTaxonomies[term.taxonomy.name] === undefined) {
- this.rulesByTaxonomies[term.taxonomy.name] = [];
- }
+ mounted() {
+ this.initJobLoaded();
+ },
- this.rulesByTaxonomies[term.taxonomy.name].push(rule);
- }
- });
- this.taxonomies.forEach(taxonomy => {
- this.filterObject[taxonomy] = itemElem => {
- return itemElem[0] === taxonomy;
- }
+ destroyed() {
+ clearTimeout(this.timeOut);
+ },
+
+ methods: {
+ initJobLoaded() {
+ this.currentJob = this.job;
+ if (this.currentJob.metadata.processing_mysgs === false) {
+ this.currentRules = this.rules;
+ this.newRulesLoaded();
+ this.initRulesParsing();
+ } else {
+ this.waitMode();
+ }
+
+ this.initSearchFunctions();
+ },
+
+ initRulesParsing() {
+ this.searchedRules.forEach(rule => {
+ rule.terms.forEach(term => {
+ if (term.taxonomy.parent.name === 'Job Categorizations') {
+ if (!this.taxonomies.includes(term.taxonomy.name)) {
+ this.taxonomies.push(term.taxonomy.name);
+ }
+
+ if (this.rulesByTaxonomies[term.taxonomy.name] === undefined) {
+ this.rulesByTaxonomies[term.taxonomy.name] = [];
+ }
+
+ this.rulesByTaxonomies[term.taxonomy.name].push(rule);
+ }
+ });
+ this.taxonomies.forEach(taxonomy => {
+ this.filterObject[taxonomy] = itemElem => {
+ return itemElem[0] === taxonomy;
+ }
+ });
});
- });
+ },
- this.filterObject['isNew'] = (itemElem) => {
- return itemElem[1].filter(rule => moment().subtract(3, 'months').isSameOrBefore(moment(rule.created_at))).length > 0;
- };
+ initSearchFunctions() {
+ this.filterObject['isNew'] = (itemElem) => {
+ return itemElem[1].filter(rule => moment().subtract(3, 'months').isSameOrBefore(moment(rule.created_at))).length > 0;
+ };
- this.filterObject['isUpdated'] = (itemElem) => {
- return itemElem[1].filter(rule => moment().subtract(3, 'months').isSameOrBefore(moment(rule.updated_at))).length > 0;
- };
- },
+ this.filterObject['isUpdated'] = (itemElem) => {
+ return itemElem[1].filter(rule => moment().subtract(3, 'months').isSameOrBefore(moment(rule.updated_at))).length > 0;
+ };
+ },
+
+ waitMode() {
+ this.timeOut = setTimeout(() => {
+ this.queryRules();
+ }, 5000);
+ },
+
+ queryRules() {
+ axios.get(route('job.rules', this.jobNumber))
+ .then(({data}) => {
+ console.log(data);
+ if (!data.job.metadata.processing_mysgs) {
+ clearTimeout(this.timeOut);
+
+ this.currentJob = data.job;
+ this.currentRules = data.rules;
+ this.newRulesLoaded();
+ this.initRulesParsing();
+ } else {
+ this.waitMode();
+ }
+ })
+ },
- methods: {
getOptions() {
return {
layoutMode: 'masonry',
@@ -294,8 +342,15 @@ export default {
getFilterData: this.filterObject
}
},
- newJobLoaded() {
- this.searchedRules = [...this.rules];
+ newRulesLoaded() {
+ this.searchedRules = [..._.orderBy(this.currentRules, 'created_at', 'desc')];
+ this.searching = false;
+ },
+ runningSearch() {
+ this.currentJob = {metadata: {}};
+ this.searching = true;
+ this.taxonomies = [];
+ this.rulesByTaxonomies = {};
},
reloadPage() {
window.location = window.location + this.searchJobKey;
@@ -308,22 +363,6 @@ export default {
this.isOpen = false;
this.currentRule = null;
},
- search() {
- if (this.searchJobKey && this.searchJobKey !== '') {
- this.searching = true;
- axios({
- url: route("rule_search", this.searchJobKey),
- method: "GET",
- })
- .then(result => {
- this.searchedRules = result.data;
- this.searching = false;
- })
- .catch(err => {
- this.searching = false;
- });
- }
- },
filterByNew() {
this.$refs.cpt.filter('isNew');
this.filterFlag = "new";
@@ -354,7 +393,7 @@ export default {
preserveScroll: true
}).then(() => {
- this.closeFlagModal();
+ this.closeFlagModal();
});
},
@@ -362,6 +401,7 @@ export default {
},
components: {
+ JobIdentification,
ViewRuleItem,
Button,
Input,
@@ -373,9 +413,11 @@ export default {
JetInput,
JetLabel,
JetSecondaryButton,
+ Loader,
ViewRule,
JobSearch,
isotope
},
}
+
diff --git a/routes/web.php b/routes/web.php
index e762fa29..d9be680d 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -22,9 +22,7 @@
|
*/
-/*Route::get('/', function () {
- return view('welcome');
-})->name('home');*/
+Route::get('/', [\App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
Route::get('/dashboard', function () {
@@ -33,6 +31,23 @@
Route::put('/current-team', [CurrentTeamController::class, 'update'])
->name('current-team.update');
+
+ Route::get( '/{jobNumber?}', [\App\Http\Controllers\OPs\JobController::class, 'show'])
+ ->name('job.rules')
+ ->where('jobNumber', '[0-9]+');
+
+ Route::post( '/{jobNumber?}', [\App\Http\Controllers\OPs\JobController::class, 'search'])
+ ->name('job.search')
+ ->where('jobNumber', '[0-9]+');
+
+
+ Route::post('/rule/{rule}/flag', [\App\Http\Controllers\RuleFlaggingController::class, 'flag'])
+ ->name('rule.flag')
+ ->where('rule', '[0-9]+');
+
+ Route::post('/rule/{rule}/unflag', [\App\Http\Controllers\RuleFlaggingController::class, 'unflag'])
+ ->name('rule.unflag')
+ ->where('rule', '[0-9]+');
});
Route::name('pm.')
@@ -135,30 +150,6 @@
});
-Route::group([
- 'middleware' => [
- 'auth:sanctum',
- 'verified',
- 'cache.headers:public;max_age=3600;etag',
- ],
- //'prefix' => 'op/'
-],
- function () {
- Route::match(['get', 'post'], '/{jobNumber?}', [\App\Http\Controllers\OPs\JobController::class, 'show'])
- ->name('home')
- ->where('jobNumber', '[0-9]+');
-
-
- Route::post('/rule/{rule}/flag', [\App\Http\Controllers\RuleFlaggingController::class, 'flag'])
- ->name('rule.flag')
- ->where('rule', '[0-9]+');
-
- Route::post('/rule/{rule}/unflag', [\App\Http\Controllers\RuleFlaggingController::class, 'unflag'])
- ->name('rule.unflag')
- ->where('rule', '[0-9]+');
- });
-
-
Route::get('nova/login', function () {
return redirect('/login/microsoft');
})->name('nova.login');