Parcourir la source

customer json

amr il y a 5 ans
Parent
commit
bb836e0e76

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

@@ -1,4 +1,4 @@
-import { NgModule } from '@angular/core';
+import { NgModule, Component } from '@angular/core';
 import { Routes, RouterModule } from '@angular/router';
 import { CustomerComponent } from './customer.component';
 import { CustomersListComponent } from './customers-list/customers-list.component';
@@ -15,6 +15,7 @@ const routes: Routes = [
       {path: 'register', component: CustomersAddEditComponent},
       {path: 'registerTwo', component: CustomersAddEditTwoComponent},
       {path: 'registerThree', component: CustomersAddEditThreeComponent},
+      {path: 'edit/:editId', component: CustomersAddEditComponent },
       {path: '**', redirectTo: 'listView', pathMatch: 'full'},
     ]},
   ];

+ 41 - 38
src/app/pages/customers/customers-list/customers-list.component.ts

@@ -32,42 +32,6 @@ export class CustomersListComponent implements OnInit {
 
 
 
-    // settings = {
-      
-    //   edit: {
-    //     editButtonContent: '<i class="nb-edit"></i>',
-    //     saveButtonContent: '<i class="nb-checkmark"></i>',
-    //     cancelButtonContent: '<i class="nb-close"></i>',
-    //   },
-    //   delete: {
-    //     deleteButtonContent: '<i class="nb-trash"></i>',
-    //     confirmDelete: true,
-    //   },
-    //   selectMode: 'multi',
-    //   actions: {
-    //     add: false,
-    //     delete: false,
-    //     select: true,
-    //     },
-    //   columns: {
-    //     name: {
-    //       title: 'Name',
-    //       type: 'string',
-    //     },
-    //     industrial: {
-    //       title: 'industrial',
-    //       type: 'string',
-    //     },
-    //     website_address: {
-    //       title: 'website',
-    //       type: 'string',
-    //     },
-    //     phone: {
-    //       title: 'Phone',
-    //       type: 'string',
-    //     },
-    //   },
-    // };
 
     dataList = [];
     dataListIds= [];
@@ -77,6 +41,44 @@ 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')
@@ -184,11 +186,12 @@ 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) {
-  // this.router.navigate(['edit/' + editId]);
-  // console.log(editId);
+  this.router.navigate(['../edit/' + editId], {relativeTo: this.route});
+  console.log(editId);
   
 }
 }

+ 1 - 1
src/app/shared/pages.service.ts

@@ -63,7 +63,7 @@ export class PagesService {
         console.log(this.auth.pathApi+ '/delete_current_users');
         
         if(pageName == 'system-admins') {
-          return this.http.post(this.auth.pathApi+ '/delete_current_companies', {'companies_id':dataIds});
+          return this.http.post(this.auth.pathApi+ '/delete_current_users', {'users_id':dataIds});
         }else if (pageName == 'customers' ) {
           
         }