Browse Source

last push

amr 5 years ago
parent
commit
464dfb363c

BIN
dist.zip


+ 65 - 0
src/app/@theme/styles/styles.scss

@@ -464,6 +464,71 @@
 
   }
 
+  .imgProfile {
+    width: 100%;
+    border-radius: 20px 20px 0 0;
+    border-radius: 50%;
+    border: 1px solid #ccc;
+
+}
+
+.imgContainer {
+    width: 200px;
+    position: relative;
+    border-radius: 20px;
+    margin: 30px auto;
+}
+.iconUpload-w {
+    width: 30px;
+    font-size: 1.25em;
+    font-weight: 700;
+    color: #252525;
+    display: inline-block;
+    border-radius: 0 0 20px 20px;
+    position: absolute;
+    right: 40%;
+    border: 1px solid #ccc;
+    border-radius: 50%;
+    bottom: 0;
+}
+
+.inputfile {
+	width: 0.1px;
+	height: 0.1px;
+	opacity: 0;
+	overflow: hidden;
+	position: absolute;
+	z-index: -1;
+}
+
+/* .inputfile + label {
+    width: 100%;
+    font-size: 1.25em;
+    font-weight: 700;
+    color: #252525;
+    background-color: transparent;
+    display: inline-block;
+    border: 1px solid #ccc;
+    border-radius: 0 0 20px 20px;
+} */
+
+.inputfile:focus + label,
+.inputfile + label:hover {
+    background-color: #00a99d;
+    color: #fff;
+}
+
+.inputfile + label {
+	cursor: pointer; /* "hand" cursor */
+}
+
+.inputfile:focus + label {
+	outline: 1px dotted #000;
+	outline: -webkit-focus-ring-color auto 5px;
+}
+
+
+
 };
 
 

+ 1 - 0
src/app/app.module.ts

@@ -41,6 +41,7 @@ import { NbWindowModule } from '@nebular/theme';
     BootstrapModalModule,
     NbWindowModule.forRoot(),
     
+    
   ],
   bootstrap: [AppComponent],
   providers: [

+ 2 - 1
src/app/pages/customers/customer.module.ts

@@ -8,7 +8,7 @@ import { CustomersAddEditComponent } from './customers-add-edit/customers-add-ed
 import { CustomerComponent } from './customer.component'
 import { from } from 'rxjs';
 import { NgxPaginationModule } from 'ngx-pagination';
-import { NbCheckboxModule } from '@nebular/theme';
+import { NbCheckboxModule, NbSelectModule } from '@nebular/theme';
 import { CustomersAddEditTwoComponent } from './customers-add-edit-two/customers-add-edit-two.component';
 import { CustomersAddEditThreeComponent } from './customers-add-edit-three/customers-add-edit-three.component';
 
@@ -20,6 +20,7 @@ import { CustomersAddEditThreeComponent } from './customers-add-edit-three/custo
     CustomersRoutingModule,
     NgxPaginationModule,
     NbCheckboxModule,
+    NbSelectModule
     
   ],
     declarations: [

+ 6 - 3
src/app/pages/customers/customers-add-edit-three/customers-add-edit-three.component.html

@@ -13,7 +13,7 @@
           <button type="button" class="btn btn-success rightW"  (click)="plusBransh()" style="margin: 20px 0;">Add New Branch</button>
           <div class="formLoop" *ngFor="let branch of company_branches; let i = index">
               <button type="button" class="btn btn-success rightW"  (click)="plusEmployee(i)" style="margin: 20px 0;">Add New Employee</button>
-              <button type="button" class="btn btn-danger" *ngIf="numOfBranshs > 1" (click)="onDeleteBransh(i)">Remove Bransh</button>
+              <button type="button" class="btn btn-danger rightW"  (click)="onDeleteBransh(i)">Remove Bransh</button>
               <div class="row">
                   <div class="col-12">
                     <div class="form-group">
@@ -58,11 +58,14 @@
                         </div>
                     </div>
                     <div class="row">
-                        <button type="button" class="btn btn-danger"  *ngIf="numOfEmployees > 1" (click)="onDeleteEployee(i,j)">Remove Employee</button>
+                        <button type="button" class="btn btn-danger" (click)="onDeleteEployee(i,j)">Remove Employee</button>
                       </div>
                 </div>
               </div>
-            </div>  
+            </div>
+            <div class=" row col-12" style="display: contents">
+              <button type="button" class="btn btn-success rightW" [disabled]="!f.valid" (click)="onSubmit()" style="float: right;">Submit</button>
+          </div>  
       </form>
      </div>     
   </div>

+ 7 - 4
src/app/pages/customers/customers-add-edit-three/customers-add-edit-three.component.ts

@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import { CustomersRegistrationService } from '../customers-registration.service';
 
 @Component({
   selector: 'ngx-customers-add-edit-three',
@@ -7,7 +8,9 @@ import { Component, OnInit } from '@angular/core';
 })
 export class CustomersAddEditThreeComponent implements OnInit {
 
-  constructor() { }
+  constructor(
+    private register: CustomersRegistrationService,
+  ) { }
   numOfBranshs : number;
   numOfEmployees: number;
 
@@ -27,8 +30,7 @@ export class CustomersAddEditThreeComponent implements OnInit {
     }]
 
   ngOnInit() {
-    this.numOfBranshs = this.company_branches.length;
-    this.numOfEmployees = this.company_branches[1].branch_users.length;
+  
   }
   plusEmployee(i){
     this.company_branches[i].branch_users.push(
@@ -65,7 +67,8 @@ export class CustomersAddEditThreeComponent implements OnInit {
     this.company_branches.slice(i , 1);
   }
 onSubmit(){
-
+this.register.company_registrtion.company_branches = this.company_branches;
+this.register.onRegister();
 }
 
 }

+ 1 - 1
src/app/pages/customers/customers-add-edit-two/customers-add-edit-two.component.html

@@ -46,7 +46,7 @@
         </div>
           <div class=" row col-12" style="display: contents">
             <button type="button" class="btn btn-warning rightW" (click)="previous()">previous</button>
-            <!-- <button type="button" class="btn btn-success rightW"  (click)="plusAdmin()">add</button> -->
+            <button type="button" class="btn btn-success rightW"  (click)="plusAdmin()">add</button>
             <button type="button" class="btn btn-success rightW" [disabled]="!f.valid" style="float: right;" (click)="next()">Next</button>
           </div>
         </form>

+ 3 - 0
src/app/pages/customers/customers-add-edit-two/customers-add-edit-two.component.ts

@@ -1,5 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { Router, ActivatedRoute } from '@angular/router';
+import { CustomersRegistrationService } from '../customers-registration.service';
 
 @Component({
   selector: 'ngx-customers-add-edit-two',
@@ -11,6 +12,7 @@ export class CustomersAddEditTwoComponent implements OnInit {
   constructor(
     private router: Router,
     private route: ActivatedRoute,
+    private register: CustomersRegistrationService,
   ) { }
 
   admins =[{
@@ -27,6 +29,7 @@ export class CustomersAddEditTwoComponent implements OnInit {
     this.router.navigate(['../register'], {relativeTo: this.route});
   }
   next(){
+    this.register.company_registrtion.company_admins = this.admins;
     this.router.navigate(['../registerThree'], {relativeTo: this.route});
   }
   plusAdmin(){

+ 92 - 8
src/app/pages/customers/customers-add-edit/customers-add-edit.component.html

@@ -12,59 +12,143 @@
       <form (ngSubmit)="next()" #f="ngForm">
         <div class="row">
 
+            <div class="col-12 col-sm-12 col-md-12 col-lg-12" style="margin-bottom:30px">
+              <div class="form-group text-center imgContainer">
+                  <img [src]="urlImg" class="imgProfile" height="200"> 
+                  <input type="file" name="file" id="file" class="inputfile" alife-file-to-base64 (onFileChanged)="onFileChanges($event)" (change)="getUrl($event)" />
+                  <label for="file" class="iconUpload-w"><i class="fas fa-upload"></i></label>
+              </div>
+            </div>
+
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="name" >Company Name<span class="spanReqired-w">*</span></label>
-              <input type="text" class="form-control" id="name" name="name" placeholder="Company name" ngModel [ngModel]="" required/>
+              <input type="text" class="form-control" id="name" name="name" placeholder="Company name" ngModel [(ngModel)]="formData.name" required/>
+            </div>
+          </div>
+
+          <div class="col-12 col-md-4">
+            <div class="form-group">
+              <label for="access_of_multiple_sites" >Number of branches<span class="spanReqired-w">*</span></label>
+              <input type="number" class="form-control" id="access_of_multiple_sites"  minlength="0" name="access_of_multiple_sites" placeholder="" ngModel [(ngModel)]="formData.access_of_multiple_sites" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="address" >Address<span class="spanReqired-w">*</span></label>
-              <input type="text" class="form-control" id="address" name="address" placeholder="company address" ngModel [ngModel]="" required/>
+              <input type="text" class="form-control" id="address" name="address" placeholder="company address" ngModel [(ngModel)]="formData.address" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="website_address">Website<span class="spanReqired-w">*</span></label>
-              <input type="text" class="form-control" id="website_address" name="website_address" placeholder="website link" ngModel [ngModel]="" required/>
+              <input type="text" class="form-control" id="website_address" name="website_address" placeholder="website link" ngModel [(ngModel)]="formData.website_address" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="phone" >Phone Number<span class="spanReqired-w">*</span></label>
-              <input type="phone" class="form-control" id="phone" name="phone" placeholder="" ngModel [ngModel]="" required/>
+              <input type="number" class="form-control" id="phone" name="phone" placeholder="" minlength="0" ngModel [(ngModel)]="formData.phone" required/>
+            </div>
+          </div>
+
+          <div class="col-12 col-md-4">
+            <div class="form-group">
+              <label for="total_users_request" >Number of users<span class="spanReqired-w">*</span></label>
+              <input type="number" class="form-control" id="total_users_request" name="total_users_request" placeholder="" minlength="0" ngModel [(ngModel)]="formData.total_users_request" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="commercial_number" >commercial no.<span class="spanReqired-w">*</span></label>
-              <input type="number" class="form-control" id="commercial_number" name="commercial_number" placeholder="" ngModel [ngModel]="" required/>
+              <input type="number" class="form-control" id="commercial_number" name="commercial_number" placeholder="" ngModel [(ngModel)]="formData.commercial_number" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="industrial" >Industrial<span class="spanReqired-w">*</span></label>
-              <input type="text" class="form-control" id="industrial" name="industrial" placeholder="" ngModel [ngModel]="" required/>
+              <input type="text" class="form-control" id="industrial" name="industrial" placeholder="" ngModel [(ngModel)]="formData.industrial" required/>
+            </div>
+          </div>
+
+          <div class="col-12 col-md-4">
+            <div class="form-group">
+              <label for="http_host_demo" >Host Name<span class="spanReqired-w">*</span></label>
+              <input type="text" class="form-control" id="http_host_demo" name="http_host_demo" placeholder="example.com" ngModel [(ngModel)]="formData.http_host_demo" required/>
+            </div>
+          </div>
+
+          <div class="col-12 col-md-4">
+            <div class="form-group">
+              <label for="" >Version Number<span class="spanReqired-w">*</span></label>
+              <input type="text" class="form-control" id="version_number" name="version_number" placeholder="" ngModel [(ngModel)]="formData.version_number" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
+            <div class="form-group ">
+              <span class="spanSelect-w">
+                <div class="col-12">
+                <span class="select-filter-before" style="margin-bottom: 10px">Pick the theme:</span>
+              </div>
+              <div class="col-12" style="margin-top: 10px;padding-left: 0px;">
+                <select [(ngModel)]="formData.theme_id" class="form-control "   name="theme_id" style="width: 100%" (input)="setThemsId($event)" >
+                  <option value="" disabled selected>Choose your theme</option>
+                  <option [value]="them.id"  *ngFor="let them of themes">{{ them.name }}</option>
+                </select>
+              </div>
+              </span>
+            </div>
+          </div>
+
+          <div class="col-12 col-md-4">
+              <div class="form-group ">
+                <span class="spanSelect-w">
+                  <div class="col-12">
+                  <span class="select-filter-before" style="margin-bottom: 10px">Pick the font family:</span>
+                </div>
+                <div class="col-12" style="margin-top: 10px;padding-left: 0px;">
+                  <select [(ngModel)]="formData.font_id" class="form-control"   name="font_id" style="width: 100%" (input)="setFontId($event)" >
+                    <option value="" disabled selected>Choose your font family</option>
+                    <option [value]="font.id"  *ngFor="let font of fonts">{{ font.name }}</option>
+                  </select>
+                </div>
+                </span>
+              </div>
+            </div>
+          
+            <div class="col-12 col-md-4">
+            <div class="form-group ">
+              <span class="spanSelect-w">
+                <div class="col-12">
+                <span class="select-filter-before" style="margin-bottom: 10px">Pick the font family:</span>
+              </div>
+              <div class="col-12" style="margin-top: 10px;padding-left: 0px;">
+                  <select  name="languages_id" class="form-control"  style="width: 100%"  (input)="setLangId($event)">
+                      <option value="" disabled selected>Choose languages</option>
+                      <option [value]="lang.id" *ngFor="let lang of languages">{{ lang.name }}</option>
+                    </select>
+              </div>
+              </span>
+            </div>
+          </div>  
+
+          <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="register_date" >Register Date<span class="spanReqired-w">*</span></label>
-              <input type="date" class="form-control" id="register_date" name="register_date" placeholder="" ngModel [ngModel]="" required/>
+              <input type="date" class="form-control" id="register_date" name="register_date" placeholder="" ngModel [(ngModel)]="formData.register_date" required/>
             </div>
           </div>
 
           <div class="col-12 col-md-4">
             <div class="form-group">
               <label for="expire_date" >Expire Date<span class="spanReqired-w">*</span></label>
-              <input type="date" class="form-control" id="expire_date" name="expire_date" placeholder="" ngModel [ngModel]="" required/>
+              <input type="date" class="form-control" id="expire_date" name="expire_date" placeholder="" ngModel [(ngModel)]="formData.expire_date" required/>
             </div>
           </div>
         </div>

+ 113 - 3
src/app/pages/customers/customers-add-edit/customers-add-edit.component.ts

@@ -1,5 +1,8 @@
 import { Component, OnInit } from '@angular/core';
 import { Router, ActivatedRoute } from '@angular/router';
+import { CustomersRegistrationService } from '../customers-registration.service';
+import { SharedService } from '../../../shared/shared.service';
+import { HttpClient } from '@angular/common/http';
 
 @Component({
   selector: 'ngx-customers-add-edit',
@@ -10,12 +13,119 @@ export class CustomersAddEditComponent implements OnInit {
 
   constructor(
     private router: Router,
-    private route: ActivatedRoute,) { }
+    private route: ActivatedRoute,
+    private register: CustomersRegistrationService,
+    private auth: SharedService,
+    private http: HttpClient
+    ) { }
 
+    themes = [];
+    fonts = [];
+    languages = [];
+    imageBase64: string = '';
+    photoType: string = '';
+    urlImg: string =   '../../../assets/images/kate.png';
+    checkChangeImage: boolean = false;
+    formData = {
+      name:'',
+      access_of_multiple_sites : '',
+      phone : '',
+      commercial_number : '',
+      industrial : '',
+      website_address :'',
+      address : '',
+      total_users_request : '',
+      http_host_demo : '',
+      version_number : '',
+      theme_id : '',
+      font_id : '',
+      register_date : '',
+      expire_date : '',
+      logo_photo : '',
+      logo_photo_type : '',
+      back_ground_photo : '',
+      back_ground_photo_type : '',
+      languages_ids : [],
+ 
+    }
+    company_general_info = this.register.company_registrtion;
   ngOnInit() {
+    this.http.get(this.auth.pathApi + '/themes_list')
+          .subscribe(
+            res => {
+              console.log(res);
+              this.themes = res[('themes')];
+            },
+            err => {
+              console.log(err);
+              
+            }
+          );
+    this.http.get(this.auth.pathApi + '/fonts_list')
+              .subscribe(
+                res =>{
+                  console.log(res);
+                 this.fonts = res[('fonts')]; 
+                },
+                err =>{
+                  console.log(err);
+                  
+                }
+              );
+    this.http.get(this.auth.pathApi + '/languages_list')
+    .subscribe(
+      res =>{
+        console.log(res);
+        this.languages = res[('languages')]; 
+      },
+      err =>{
+        console.log(err);
+        
+      }
+    );
   }
- 
+  
+  setThemsId(event){
+    this.formData.theme_id = event.target.value;
+  }
+  setFontId(event){
+    this.formData.font_id = event.target.value;
+  }
+  setLangId(event){
+    this.formData.languages_ids.push(event.target.value);
+  }
+  onFileChanges(event) {
+    console.log(event);
+    this.imageBase64 = event[0].base64;
+    this.photoType = event[0].type.split('/');
+    console.log(this.photoType[1]);
+    console.log(this.imageBase64);
+    this.formData.logo_photo = this.imageBase64;
+    this.formData.logo_photo_type = this.photoType;
+    this.checkChangeImage = true;
+  }
+  getUrl(event) {   
+    if (event.target.files && event.target.files[0]) {
+    var reader = new FileReader();
+    reader.readAsDataURL(event.target.files[0]); // read file as data url
+    reader.onload = (event) => { // called once readAsDataURL is completed
+      this.urlImg = event.target['result'];
+    }
+  }
+ }
+
   next(){
-    this.router.navigate(['../registerTwo'], {relativeTo: this.route});
+    console.log(this.formData);
+    this.company_general_info.company_name = this.formData.name;
+    this.company_general_info.address = this.formData.address;
+    this.company_general_info.website_address = this.formData.website_address;
+    this.company_general_info.phone = this.formData.phone;
+    this.company_general_info.commercial_number = this.formData.commercial_number;
+    this.company_general_info.industrial = this.formData.industrial;
+    this.company_general_info.register_date = this.formData.register_date;
+    this.company_general_info.expire_date = this.formData.expire_date;
+    // this.router.navigate(['../registerTwo'], {relativeTo: this.route});
+    console.log(this.formData);
+    
   }
 }

+ 1 - 40
src/app/pages/customers/customers-list/customers-list.component.ts

@@ -17,7 +17,7 @@ import { SmartTableData } from '../../../@core/data/smart-table';
 })
 export class CustomersListComponent implements OnInit {
 
-  source: LocalDataSource = new LocalDataSource();
+  
 
 
   constructor(
@@ -41,44 +41,6 @@ export class CustomersListComponent implements OnInit {
     count: number;
     perPagePagenation: number;
     selectedAll: any;
-    company_registrtion = 
-    {
-
-      company_name : '',
-      phone : '',
-      commercial_number : '',
-      industrial : '',
-      website_address :'',
-      address : '',
-      total_users_request : '',
-      register_date : '',
-      expire_date : '',
-      logo_photo : '',
-      company_admins : [
-         {  
-            name : '',
-            email : '',
-            password : '',
-            password_confirmation : ''
-   
-         }],
-      company_branches : [
-         {
-            branch_name : '',
-            branch_users : [
-               {
-                  name: '',
-                  email : '',
-                  type : '',
-                  position : '',
-                  phone : '',
-                  hire_date: '',
-                  is_active: null,
-                  password : '',
-                  password_confirmation : ''
-               }]
-         }]
-    }
 
   ngOnInit() {
     this.pageser.getListData(this.currentPage, this.dataTableNumber, 'all', 'customers')
@@ -186,7 +148,6 @@ export class CustomersListComponent implements OnInit {
   }
   onAdding(){
     this.router.navigate(['../register'], {relativeTo: this.route});
-    localStorage.setItem('company_registrtion', JSON.stringify(this.company_registrtion));
   }
 
   onEdit(editId: number) {

+ 44 - 0
src/app/pages/customers/customers-registration.service.ts

@@ -0,0 +1,44 @@
+import { Injectable } from '@angular/core';
+import { SharedService } from '../../shared/shared.service';
+import { HttpClient } from '@angular/common/http';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class CustomersRegistrationService {
+
+  constructor(
+    private auth: SharedService,
+    private http: HttpClient,
+
+  ) { }
+  company_registrtion = 
+    {
+
+      company_name : '',
+      access_of_multiple_sites : '',
+      phone : '',
+      commercial_number : '',
+      industrial : '',
+      website_address :'',
+      address : '',
+      total_users_request : '',
+      http_host_demo : '',
+      version_number : '',
+      theme_id : '',
+      font_id : '',
+      register_date : '',
+      expire_date : '',
+      logo_photo : '',
+      logo_photo_type : '',
+      back_ground_photo : '',
+      back_ground_photo_type : '',
+      languages_ids : [],
+      company_admins : [],
+      company_branches : []
+    }
+    onRegister(){
+      // return this.http.post(this.auth.pathApi + '/register_company' , this.company_registrtion);
+      console.log(this.company_registrtion);
+    }
+}