Fairoj : Section List introduced in Sales PD

This commit is contained in:
venbatechnologies@gmail.com 2020-02-24 17:54:42 +05:30
parent edd0801be9
commit 3effa8d299
40 changed files with 237 additions and 320091 deletions

View File

@ -109,25 +109,44 @@ export class QuesTemplateComponent {
// this.original_result_data.questions=this.original_result_data.questions.filter(val=>val.question_key == 'selfie_with_person_met')
this.checkGroupandPatchValues()
}
else{
this.sendAutomaticallyToApi()
}
this.loadingProvider.dismissLoader()
},err=>{
this.loadingProvider.dismissLoader()
})
}
sendAutomaticallyToApi(){
if(this.local_ques_JSON.section_id == '8'){
this.onSubmit(1);
}
}
proceedonChangeProperty(local_value_obj?){
console.log("On Change Property");
console.log("On Change Property",this.quesAnsForm.value.questions);
this.quesAnsForm.controls.questions['controls'].forEach((val,p_i)=>{
// JSON QUESTION CHANGE FOR SINGLE
let form_c=val.value
if(this.original_result_data.questions[p_i] != undefined){
if(form_c.question_key != this.original_result_data.questions[p_i].question_key){
this.original_result_data.questions.splice(p_i,0,form_c)
console.log("key",p_i,this.quesAnsForm.value)
if (this.original_result_data.questions[p_i] != undefined) {
if (this.quesAnsForm.value.questions[p_i].question_key !== this.original_result_data.questions[p_i].question_key) {
// ADDING THE QUESTION TO FETCHED DATA ARRAY
if (this.quesAnsForm.value.questions.filter(data => data.question_key! == this.quesAnsForm.value.questions[p_i].question_key) == 0) {
this.original_result_data.questions.splice(p_i, 0, this.quesAnsForm.value.questions[p_i])
}
// ---- END OF ADDING DATA ----
// REMOVING THE QUESTION TO FETCHED DATA ARRAY
else {
console.log("Else part>>", this.quesAnsForm.value.questions[p_i].question_key, this.original_result_data.questions[p_i].question_key, val)
this.original_result_data.questions.splice(p_i, 1)
console.log("after", this.original_result_data.questions, this.quesAnsForm.value.questions)
}
// --- END OF REMOVING QUESTION ---
}
}
}
//---- END OF JSON QUESTION CHANGE----
if(val.value.is_repeatable == '1'){
@ -196,11 +215,12 @@ export class QuesTemplateComponent {
// FOR CREATING A SUBFIELD FOR CHOOSED OPTION OTHERS
else {
let control=this.quesAnsForm.get('questions')['controls'][p_i]
if(control != undefined && control != null){
if (control.value.answers != null && control.value.answers.length > 0) {
this.creatSubField(control, parent_ques.answer_value)
}
}
}
})
this.proceedonChangeProperty(modified)
@ -1000,13 +1020,15 @@ this.proceedonChangeProperty(modified)
let section_redirect=apiresult['records']
let section_dis_names:any=[];
if(section_redirect.length > 0){
section_redirect.forEach(res=>{
section_dis_names.push(res.sectin_name)
})
let alert=this.toastProvider.setAlertWithOkButton("<small>Sales PD is incomplete<small>","The Following sections are in draft status <b>"+section_dis_names+'</b>')
}
let alert=this.toastProvider.setAlertWithOkButton("<small>Sales PD is incomplete<small>","The Following sections are not Saved <b>"+section_dis_names+'</b>')
alert.present()
alert.onDidDismiss(()=>{
this.redirect_to_section(section_redirect[0].section_id)
this.redirect_to_section('')
})
}
@ -1079,7 +1101,12 @@ this.proceedonChangeProperty(modified)
break;
}
let product_id=localStorage.getItem('product_id_salesPD')
if(re_section != ''){
this.navCtrl.setRoot(re_section,{product_id:product_id})
}
else{
this.navCtrl.pop();
}
}
insertSectionDataLocally(section_data){

View File

@ -7,10 +7,13 @@ import { SalesPdProvider } from '../../providers/sales-pd/sales-pd';
import { MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatDialogModule, MatListModule, MatExpansionModule, MatGridListModule, MatIconModule, MatInputModule, MatMenuModule, MatNativeDateModule, MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, MatFormFieldModule } from '@angular/material';
import { ReactiveFormsModule } from '@angular/forms';
import { IonicStorageModule } from '@ionic/storage';
import { SectionListPage } from '../section-list/section-list';
import { SectionListPageModule } from '../section-list/section-list.module';
@NgModule({
declarations: [
// SectionListPage,
HomePage,
Section1,
Section2,
@ -24,6 +27,7 @@ import { IonicStorageModule } from '@ionic/storage';
],
entryComponents:[HomePage,Section1, Section2,Section3, Section4, Section5, Section6, Section7, Section8, Section9],
imports: [
SectionListPageModule,
ComponentsModule,
IonicPageModule.forChild(HomePage),
MatButtonModule,

View File

@ -6,6 +6,7 @@ import { PdtriggerProvider } from '../../../../providers/pdtrigger/pdtrigger';
import { SalesPDlistPage } from '../sales-p-dlist/sales-p-dlist';
import { CameraProvider } from '../../providers/camera/camera';
import { LoadingProvider } from '../../../../providers/common-provider/loading';
import { SectionListPage } from '../section-list/section-list';
/**
@ -61,7 +62,7 @@ export class HomePage{
sendProduct(){
if(this.product != ''){
localStorage.setItem('product_id_salesPD',this.product)
this.navCtrl.push(Section1,{product_id:this.product})
this.navCtrl.push(SectionListPage,{product_id:this.product})
}
else{
this.toastProvider.lenderappmessage("Please Choose the Product")
@ -501,9 +502,9 @@ export class Section9 {
all_sections:any;
constructor(public navCtrl: NavController, public navParams: NavParams,private SalesPDService:SalesPdProvider,private loadingProvider:LoadingProvider,private toastProvider:ToastProvider) {
// if(this.navParams.get('sec_no')){
// this.section_local=this.navParams.get('sec_no')
// }
if(this.navParams.get('section_id')){
this.section_local=this.navParams.get('section_id')
}
// this.SalesPDService.getData().subscribe(result=>{
// this.raw_data=result['records']
// this.all_sections=this.raw_data.sections.map(val=>val.section_id)
@ -536,7 +537,7 @@ export class Section9 {
console.log(event,this.all_sections[this.all_sections.length - 1]);
if(this.all_sections[this.all_sections.length - 1] != event.section_id){
this.navCtrl.push(Section9)
this.navCtrl.pop()
}
else{
// this.sendData()

View File

@ -5,6 +5,7 @@ import { HomePage, Section1 } from '../home/home';
import { ToastProvider } from '../../../../providers/common-provider/toast';
import { LoadingProvider } from '../../../../providers/common-provider/loading';
import { ReportViewer } from '../report-pdf-viewer/pdf-modal';
import { SectionListPage } from '../section-list/section-list';
/**
* Generated class for the SalesPDlistPage page.
@ -67,9 +68,10 @@ export class SalesPDlistPage {
editForm(value_obj){
// let product= localStorage.getItem('product_id_salesPD')
// storing the sales_pd_id and product id in local storagey
this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj.sales_pd_id).then(()=>{
localStorage.setItem('product_id_salesPD',value_obj.product_id)
this.navCtrl.push(Section1,{product_id:value_obj.product_id})
this.navCtrl.push(SectionListPage,{product_id:value_obj.product_id})
})
}
salesPDpdf(pdfdetail){

View File

@ -0,0 +1,30 @@
<!--
Generated template for the SectionListPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar color="optblue">
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Section List</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<mat-card class="card-class" [ngClass]="{'border-enable': sales_pd_id == null && sec.is_disabled}" *ngFor="let sec of section_template" (click)="goto(sec.order_id)">
<ion-row>
<ion-col col-12>
<h6>{{sec.section_name}}</h6>
</ion-col>
<!-- <ion-col col-1>
<ion-icon name="checkmark-circle-outline"></ion-icon>
</ion-col> -->
</ion-row>
</mat-card>
</ion-content>

View File

@ -0,0 +1,15 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { SectionListPage } from './section-list';
import { MatCardModule } from '@angular/material';
@NgModule({
declarations: [
SectionListPage,
],
imports: [
IonicPageModule.forChild(SectionListPage),
MatCardModule,
],
})
export class SectionListPageModule {}

View File

@ -0,0 +1,36 @@
page-section-list {
.card-class{
h6{
margin: 0px !important;
color: darkblue;
}
padding: 10px 9px;
margin: 0px;
margin-bottom: 14px;
border-radius: 5px !important;
/* font-size: 12px; */
// box-shadow: 0px;
box-shadow: 0 4px 4px -10px rgba(0, 0, 0, 0.56), 0 5px 16px 0 rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2) !important;
border-left: 1px solid blue !important;
border:1px solid lavender;
// border: 1px solid #32db64;
// 2px solid #e1383863
// 2px solid #32db6475
// border-left: 1px sold red !important;
ion-icon{
color: #008828
}
transition: padding 2s;
}
.card-class:active {
padding: 20px;
}
.border-enable{
border-left: 1px solid #000000a8 !important;
h6{
margin: 0px !important;
color: darkgray;
}
}
}

View File

@ -0,0 +1,96 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { SalesPdProvider } from '../../providers/sales-pd/sales-pd';
import { Section9 } from '../home/home';
import { ToastProvider } from '../../../../providers/common-provider/toast';
/**
* Generated class for the SectionListPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-section-list',
templateUrl: 'section-list.html',
})
export class SectionListPage {
section_template: any=[];
raw_data: any;
all_sections: any;
product_id:string
sales_pd_id: any;
constructor(public navCtrl: NavController, public navParams: NavParams,private SalesPDService:SalesPdProvider,private toastProvider:ToastProvider) {
if(this.navParams.get('product_id')){
this.product_id=this.navParams.get('product_id')
}
}
ionViewDidLoad() {
console.log('ionViewDidLoad SectionListPage');
this.getTemplate()
}
ionViewDidEnter(){
this.SalesPDService.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((key_value)=>{
if(key_value && key_value != null && key_value != '' && key_value != undefined){
this.sales_pd_id=key_value
}
else{
this.sales_pd_id=null
}
})
}
getTemplate(){
this.SalesPDService.getData(this.product_id).subscribe(result=>{
console.log("result",result)
if(result.hasOwnProperty('records')){
this.raw_data=JSON.parse(result['records'].template)
this.raw_data.sections.forEach((val,index)=>{
val.order_id=index+1
})
console.log(this.raw_data)
this.SalesPDService.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((key_value)=>{
console.log("sales pd id",key_value)
if(key_value && key_value != null && key_value != '' && key_value != undefined){
this.sales_pd_id=key_value
}
else{
this.sales_pd_id=null
}
this.section_template=this.raw_data.sections.map(val=> {
let temp={section_id:val.section_id,section_name:val.section_name,order_id:val.order_id,is_disabled:val.section_id != '1' ? this.sales_pd_id == null ? true : false : false}
return temp
})
console.log(this.section_template)
})
this.SalesPDService.original_rawData=this.raw_data
localStorage.setItem('question_temp_salespd',JSON.stringify(this.raw_data))
console.log("sales pd",this.SalesPDService.original_rawData)
this.all_sections=this.raw_data.sections.map(val=>val.section_id)
this.SalesPDService.available_sections=this.all_sections
this.SalesPDService.current_section='1';
}
else{
}
})
}
goto(section_id){
// this.SalesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj.sales_pd_id).then(()=>{
// localStorage.setItem('product_id_salesPD',value_obj.product_id)
if(this.sales_pd_id == null && section_id != '1'){
this.toastProvider.lenderappmessage("Please Fill General Section First !!")
return;
}
setTimeout(()=>{
this.navCtrl.push(Section9,{section_id:section_id})
},50)
}
}

View File

@ -35,7 +35,7 @@ export class ConstantsProvider {
}
let development={
url:'https://demo.pdgenie.com/sparqapi/api/',
url:'https://apitest.pdgenie.com/sparqapi/api/',
authorization:'sparqvenba2018',
lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907",
@ -44,7 +44,7 @@ export class ConstantsProvider {
}
let testing={
url:'https://demo.pdgenie.com/sparqtest/api/',
url:'https://apitest.pdgenie.com/sparqtest/api/',
authorization:'sparqvenba2018',
lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907",

Binary file not shown.

View File

@ -1,50 +0,0 @@
// Ionicons Icon Font CSS
// --------------------------
// Ionicons CSS for Ionic's <ion-icon> element
// ionicons-icons.scss has the icons and their unicode characters
$ionicons-font-path: $font-path !default;
@import "ionicons-icons";
@import "ionicons-variables";
@font-face {
font-family: "Ionicons";
src: url("#{$ionicons-font-path}/ionicons.woff2?v=#{$ionicons-version}") format("woff2"),
url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"),
url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype");
font-weight: normal;
font-style: normal;
}
ion-icon {
display: inline-block;
font-family: "Ionicons";
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-rendering: auto;
text-transform: none;
speak: none;
@include rtl() {
&[aria-label^="arrow"]::before,
&[flip-rtl]::before {
transform: scaleX(-1);
}
&[unflip-rtl]::before {
transform: scaleX(1);
}
}
&::before {
display: inline-block;
}
}

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,34 +0,0 @@
// Noto Sans Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$noto-sans-font-path: $font-path !default;
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 300;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 400;
src: local("Noto Sans"), local("Noto-Sans-Regular"), url("#{$noto-sans-font-path}/noto-sans-regular.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-regular.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 500;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}
@font-face {
font-family: "Noto Sans";
font-style: normal;
font-weight: 700;
src: local("Noto Sans Bold"), local("Noto-Sans-Bold"), url("#{$noto-sans-font-path}/noto-sans-bold.woff") format("woff"), url("#{$noto-sans-font-path}/noto-sans-bold.ttf") format("truetype");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,34 +0,0 @@
// Roboto Font
// Google
// Apache License, version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
$roboto-font-path: $font-path !default;
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 300;
src: local("Roboto Light"), local("Roboto-Light"), url("#{$roboto-font-path}/roboto-light.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-light.woff") format("woff"), url("#{$roboto-font-path}/roboto-light.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 400;
src: local("Roboto"), local("Roboto-Regular"), url("#{$roboto-font-path}/roboto-regular.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-regular.woff") format("woff"), url("#{$roboto-font-path}/roboto-regular.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"), url("#{$roboto-font-path}/roboto-medium.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-medium.woff") format("woff"), url("#{$roboto-font-path}/roboto-medium.ttf") format("truetype");
}
@font-face {
font-family: "Roboto";
font-style: normal;
font-weight: 700;
src: local("Roboto Bold"), local("Roboto-Bold"), url("#{$roboto-font-path}/roboto-bold.woff2") format("woff2"), url("#{$roboto-font-path}/roboto-bold.woff") format("woff"), url("#{$roboto-font-path}/roboto-bold.ttf") format("truetype");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
null

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,9 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<script data-ionic="inject">
(function(w){var i=w.Ionic=w.Ionic||{};i.version='3.9.2';i.angular='5.0.3';i.staticDir='build/';})(window);
</script>
<meta charset="UTF-8">
<title>Ionic App</title>
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">