JOb add
This commit is contained in:
@@ -270,6 +270,11 @@ const routes: Routes = [
|
||||
path: 'history',
|
||||
loadChildren: () => import('./pages/history/history.module').then(m => m.HistoryPageModule)
|
||||
},
|
||||
{
|
||||
path: 'addjob',
|
||||
loadChildren: () => import('./pages/addjob/addjob.module').then(m => m.AddjobPageModule)
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<ion-select-option *ngFor="let item of jobGroupDataResult"
|
||||
value="{{item.group_id}}"
|
||||
selected
|
||||
>{{item.group_name}}</ion-select-option>
|
||||
>{{item.group_name}} ({{item.member_count}}) </ion-select-option>
|
||||
</ion-select>
|
||||
</div>
|
||||
<div style="float: right; width: 20%;">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { AddjobPage } from './addjob.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: AddjobPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AddjobPageRoutingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { AddjobPageRoutingModule } from './addjob-routing.module';
|
||||
|
||||
import { AddjobPage } from './addjob.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
AddjobPageRoutingModule
|
||||
],
|
||||
declarations: [AddjobPage]
|
||||
})
|
||||
export class AddjobPageModule {}
|
||||
@@ -0,0 +1,93 @@
|
||||
<ion-header mode="ios" class="ion-no-border">
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start" (click)="onBack()">
|
||||
<ion-button>
|
||||
<ion-icon name="arrow-back-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Add Job</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<div class="boxed_contents">
|
||||
<div style="padding: 5px;">
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-textarea label="Title"
|
||||
(ionChange)="verifyEntry()"
|
||||
[(ngModel)]='title'
|
||||
maxlength="149"
|
||||
placeholder="Enter Title"></ion-textarea>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-textarea label="Description"
|
||||
(ionChange)="verifyEntry()"
|
||||
[(ngModel)]='description'
|
||||
maxlength="299"
|
||||
labelPlacement="stacked"
|
||||
placeholder="Job Description"></ion-textarea>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-textarea label="Delivery Details"
|
||||
(ionChange)="verifyEntry()"
|
||||
[(ngModel)]='job_detail'
|
||||
style="min-height: 150px;"
|
||||
maxlength="1440"
|
||||
labelPlacement="floating"
|
||||
placeholder="Delivery Details"></ion-textarea>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-select
|
||||
(ionChange)="verifyEntry()"
|
||||
[(ngModel)]='timeline_days'
|
||||
label="Timeline (expected duration)"
|
||||
label-placement="stacked">
|
||||
<ion-select-option *ngFor="let item of durationArray" value="{{item.duration}}">{{item.name}}</ion-select-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-input label="Price"
|
||||
[(ngModel)]='price'
|
||||
(ionChange)="verifyEntry()"
|
||||
style="text-align: right;"
|
||||
placeholder="0.00"></ion-input>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-select
|
||||
(ionChange)="verifyEntry()"
|
||||
style="min-width: 100px;"
|
||||
[(ngModel)]='country'
|
||||
label="Currency">
|
||||
<ion-select-option *ngFor="let item of walletResult;" value="{{item.country}}">{{item.code}}</ion-select-option>
|
||||
</ion-select>
|
||||
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
<ion-grid style="background-color: aliceblue;margin-top: 15px;">
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<div style="font-weight: bolder; color: #8b198e;" *ngIf="result_message !='' ">
|
||||
{{result_message}}
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col></ion-col>
|
||||
<ion-col>
|
||||
<ion-button
|
||||
shape="round"
|
||||
size="small"
|
||||
[disabled]="isDisabled"
|
||||
(click)="processCreateJob()">Create Job</ion-button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { AddjobPage } from './addjob.page';
|
||||
|
||||
describe('AddjobPage', () => {
|
||||
let component: AddjobPage;
|
||||
let fixture: ComponentFixture<AddjobPage>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddjobPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AddjobPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,122 @@
|
||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||
import {AlertController, LoadingController, NavController} from "@ionic/angular";
|
||||
import {Router} from "@angular/router";
|
||||
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
||||
import {WrenchService} from "../../services/wrench.service";
|
||||
import {TasksDataService} from "../../store/tasks-data.service";
|
||||
import {UserWalletService} from "../../store/user-wallet.service";
|
||||
import {apiConst} from "../../../constants/constant";
|
||||
|
||||
@Component({
|
||||
selector: 'app-addjob',
|
||||
templateUrl: './addjob.page.html',
|
||||
styleUrls: ['./addjob.page.scss'],
|
||||
})
|
||||
export class AddjobPage implements OnInit {
|
||||
@ViewChild('title') title:any;
|
||||
@ViewChild('description') description: any;
|
||||
@ViewChild('job_detail') job_detail: any;
|
||||
@ViewChild('timeline_days') timeline_days: any;
|
||||
@ViewChild('currency') currency:any;
|
||||
@ViewChild('price') price:any;
|
||||
@ViewChild('country') country:any;
|
||||
durationArray:any;
|
||||
curr_session:string='';
|
||||
result_message:string='';
|
||||
walletResult:any;
|
||||
walletData: [];
|
||||
isDisabled:boolean=true;
|
||||
constructor(private navctr: NavController,
|
||||
private router: Router,
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private alertController:AlertController,
|
||||
private wrenchService: WrenchService,
|
||||
private loadingCtrl: LoadingController,
|
||||
public userWalletService: UserWalletService,
|
||||
public tasksDataService:TasksDataService,) {
|
||||
|
||||
this.durationArray = this.sessionDataProviderService.durationArray;
|
||||
this.walletResult = this.userWalletService.walletResult.result_list;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
onBack() {
|
||||
this.navctr.back();
|
||||
}
|
||||
|
||||
|
||||
verifyEntry() {
|
||||
this.isDisabled = !(this.title.length > 5 &&
|
||||
this.description.length > 5 &&
|
||||
this.job_detail.length > 10 &&
|
||||
this.timeline_days > 0 &&
|
||||
this.price > 0 &&
|
||||
this.country.length > 1);
|
||||
}
|
||||
|
||||
async processCreateJob(){
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Creating Job...',
|
||||
duration: 5000,
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.reqData = {
|
||||
action: apiConst.WRENCHBOARD_JOB_CREATEJOB,
|
||||
member_id: this.sessionDataProviderService.member_id,
|
||||
uid: this.sessionDataProviderService.member_uid,
|
||||
sessionid: this.sessionDataProviderService.session ,
|
||||
country: this.country,
|
||||
price:this.price*100,
|
||||
timeline_days:this.timeline_days,
|
||||
banner:'default.jpg',
|
||||
title:this.title,
|
||||
description:this.description,
|
||||
job_detail:this.job_detail,
|
||||
category:''
|
||||
}
|
||||
|
||||
loading.present();
|
||||
this.isDisabled = true;
|
||||
|
||||
this.wrenchService.jobManagerCreateJob(this.reqData).subscribe(
|
||||
jobManagerCreateResult => {
|
||||
loading.dismiss();
|
||||
this.jobManagerCreateResult = jobManagerCreateResult;
|
||||
console.log("jobManagerCreateResult RETURN->", this.jobManagerCreateResult);
|
||||
if (this.jobManagerCreateResult !=null && this.jobManagerCreateResult.job_uid != '' ){
|
||||
this.result_message = "Job Added";
|
||||
setTimeout(()=>{
|
||||
dispatchEvent(new Event("app_add_jobs"));
|
||||
this.onBack();
|
||||
}, 3000);
|
||||
}
|
||||
else{
|
||||
this.result_message ="Error - Unable to Create Job";
|
||||
setTimeout(()=>{
|
||||
this.result_message ="";
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
reqData: {
|
||||
action:number,
|
||||
member_id: number,
|
||||
uid: string, sessionid: string,
|
||||
country:string,
|
||||
price:number,
|
||||
timeline_days:number,
|
||||
banner:string,
|
||||
title:string,
|
||||
description:string,
|
||||
job_detail:string,
|
||||
category:string
|
||||
};
|
||||
jobManagerCreateResult:any;
|
||||
|
||||
|
||||
}
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
<div class="detail">
|
||||
<ion-label class="name">{{item.short_title}}</ion-label>
|
||||
<ion-label class="bg_text ovf"
|
||||
<ion-label class="bg_text ovf" style="background-color: white;"
|
||||
>{{item.short_description}}</ion-label
|
||||
>
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ ion-content {
|
||||
border-radius: 10px;
|
||||
margin-bottom: 20px;
|
||||
&.OFFERS{
|
||||
background-color: #400741;
|
||||
background-color: #186875;
|
||||
.name{
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -88,10 +88,21 @@ export class JoblistPage implements OnInit {
|
||||
},1000);
|
||||
}
|
||||
addNewJob(){
|
||||
this.isModalOpen = true;
|
||||
this.isModalOpenBackdrop= true;
|
||||
this.router.navigate(['addjob']);
|
||||
//this.isModalOpen = true;
|
||||
// this.isModalOpenBackdrop= true;
|
||||
}
|
||||
|
||||
|
||||
//ionViewDidEnter(){ debugger }
|
||||
ionViewWillLeave(){
|
||||
this.isModalOpen = false;
|
||||
this.isModalOpenBackdrop= false;
|
||||
this.setCloseModal();
|
||||
}
|
||||
ionViewDidLeave(){ this.setCloseModal(); }
|
||||
// ngOnDestroy(){ debugger }
|
||||
|
||||
processCreateJob(){
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user