bulletin.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. define(['app'], function (app) {
  2. app.directive('uploadImgFile', function ($rootScope) {
  3. return {
  4. restrict: 'A',
  5. scope: true,
  6. link: function (scope, element, attr) {
  7. element.on('change', function (event) {
  8. var files = event.target.files;
  9. if ($rootScope.imageFormat.indexOf(files[0].type) != -1) {
  10. $rootScope.uploadfile = files[0];
  11. }
  12. else {
  13. $rootScope.$apply(function () {
  14. $rootScope.modalShown = true;
  15. $rootScope.message = "Please select Image format only"
  16. angular.element("input[type='file']").val(null);
  17. })
  18. }
  19. })
  20. }
  21. }
  22. }
  23. )
  24. function readURL(input) {
  25. var num = current_imageObject.attr('data-id');
  26. if (input.files && input.files[0]) {
  27. var reader = new FileReader();
  28. reader.onload = function (e) {
  29. $('#store_image_' + num)
  30. .attr('src', e.target.result)
  31. .width(119)
  32. .height(112);
  33. }
  34. reader.readAsDataURL(input.files[0]);
  35. }
  36. }
  37. app.service("UploadFileService", function ($http, $rootScope, $timeout) {
  38. var service = {}
  39. service.upload = upload;
  40. var returnfun;
  41. function upload(formData, scope) {
  42. //console.log("File : ",formData);
  43. returnfun = scope
  44. $rootScope.loadingCont = true;
  45. var xhr;
  46. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  47. xhr = new XMLHttpRequest();
  48. }
  49. else {// code for IE6, IE5
  50. xhr = new ActiveXObject("Microsoft.XMLHTTP");
  51. }
  52. //this._scope['formLoad'] = false;
  53. xhr.upload.addEventListener("progress", uploadProgress, false)
  54. xhr.addEventListener("load", function (evt) {
  55. returnfun(evt.target.responseText);
  56. }, false)
  57. xhr.addEventListener("error", uploadFailed, false)
  58. xhr.addEventListener("abort", uploadCanceled, false)
  59. xhr.open("POST", "../services/bulletin.php")
  60. $rootScope.progressVisible = true
  61. xhr.send(formData);
  62. }
  63. function uploadProgress(evt) {
  64. $rootScope.$apply(function () {
  65. if (evt.lengthComputable) {
  66. //$rootScope.progress = Math.round((evt.loaded * 100 )/ evt.total)
  67. } else {
  68. //$rootScope.progress = 'unable to compute'
  69. }
  70. })
  71. }
  72. function uploadComplete(evt) {
  73. //scope.showAlert();
  74. }
  75. function uploadFailed(evt) {
  76. $rootScope.$apply(function () {
  77. $rootScope.loadingCont = false;
  78. })
  79. }
  80. function uploadCanceled(evt) {
  81. $rootScope.$apply(function () {
  82. $rootScope.loadingCont = false;
  83. })
  84. }
  85. return service;
  86. })
  87. app.controller('BulletinCtrl', function ($scope, $rootScope, AppData, $location, UploadFileService) {
  88. //Every module Set Same Variable//
  89. $rootScope.menucont = true;
  90. $rootScope.pageLoadComp = false;
  91. $scope.formLoad = false;
  92. $scope.listFound = false;
  93. $scope.pageData = bulletinData[$rootScope.selLanguage];
  94. $scope.formAction = "Add";
  95. $rootScope.sideselect = $scope.pageData.sidemenu[0];
  96. $scope.itemdetail = [];
  97. $scope.selectedIndex = null;
  98. $rootScope.cofirmWindow = false;
  99. $scope.submenu = $scope.pageData.sidemenu;
  100. $scope.tblheading = $rootScope.sideselect.headingText;
  101. $scope.url = "../senddata/log/";
  102. $scope.pageurl = "../senddata/bulletin/";
  103. $scope.commonurl = "../senddata/common/";
  104. $rootScope.imageFormat = ["image/jpeg", "image/png"]
  105. $rootScope.pdfFormat = ["application/pdf"];
  106. $rootScope.fileFormat = ["video/mp4", "application/pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx"];
  107. $rootScope.docFormat = ["doc", "docx", "xls", "xlsx", "ppt", "pptx"];
  108. $rootScope.uploadfile = '';
  109. //filter data
  110. $scope.common_filter = [];
  111. $scope.zonearr = [];
  112. $scope.regionList = [];
  113. $scope.dealerList = [];
  114. $scope.search_box = true;
  115. $rootScope.modalShown = false;
  116. $rootScope.cofirmWindow = false;
  117. //pagination
  118. $scope.viewby = '10';
  119. $scope.currentPage = 1;
  120. $scope.itemsPerPage = $scope.viewby;
  121. $scope.maxSize = 5; //Number of pager buttons to show
  122. $scope.choice = {};
  123. $scope.choice.filelang = '';
  124. //Check Session//
  125. $scope.formData = {}
  126. $rootScope.formData = {}
  127. $scope.formData.roleList = [];
  128. $rootScope.formData.roleList = [];
  129. $scope.formData.ismenuload = "Yes";
  130. if ($rootScope.items == undefined || $rootScope.items == null) {
  131. $scope.formData.ismenuload = "No";
  132. }
  133. $scope.formData.funName = "checksession";
  134. $scope.formData.lang = $rootScope.selLanguage;
  135. $scope.formData.start = 0;
  136. $scope.formData.limit = 2;
  137. AppData.sendData($scope.url, $scope.formData, function (res) {
  138. if (res.cont) {
  139. if ($rootScope.items == undefined || $rootScope.items == null) {
  140. $rootScope.items = res.item.control;
  141. }
  142. for (var i = 0; i < $rootScope.items.length; i++) {
  143. if ($location.path() == $rootScope.items[i].modulepath) {
  144. $rootScope.modulename = $rootScope.items[i].modulename;
  145. $scope.usercontrol = String($rootScope.items[i].permission).split("|");
  146. }
  147. }
  148. $scope.listFound = true;
  149. $scope.statusobj = res.item.status;
  150. $rootScope.username = res.item.username;
  151. $scope.bulletinList = function () {
  152. //var tobj = {};
  153. console.log($scope.listFound)
  154. $scope.searchvalue = ($scope.formData.mymodel != '') ? $scope.formData.mymodel : "";
  155. $scope.formData.funName = "bulletinlist";
  156. $scope.formData.lang = "en_us";
  157. if ($rootScope.sideselect.id == 1) {
  158. $scope.formData.pn = $scope.currentPage;
  159. $scope.formData.nr = $scope.itemsPerPage;
  160. } else {
  161. $scope.formData.pn = '';
  162. $scope.formData.nr = '';
  163. }
  164. $scope.formData.key = $scope.searchvalue;
  165. AppData.sendData($scope.pageurl, $scope.formData, function (res) {
  166. if (res.cont) {
  167. if (res.item != undefined) {
  168. $scope.bulletList = res.item.bulletin;
  169. $scope.totalItems = res.item.total_records;
  170. // $scope.listFound = true;
  171. }
  172. } else {
  173. $scope.listFound = false;
  174. }
  175. })
  176. }
  177. $scope.bulletinList();
  178. $scope.setPage = function (pageNo) {
  179. console.log(pageNo)
  180. $scope.currentPage = pageNo;
  181. };
  182. $scope.pageChanged = function () {
  183. console.log($scope.currentPage)
  184. $scope.bulletinList();
  185. };
  186. $scope.setItemsPerPage = function (num) {
  187. $scope.itemsPerPage = num;
  188. $scope.currentPage = 1; //reset to first page
  189. $scope.bulletinList();
  190. }
  191. $scope.filterData = function () {
  192. $scope.bulletinList();
  193. }
  194. } else {
  195. $location.path("/login");
  196. }
  197. })
  198. $scope.getRole = function () {
  199. var obj = {};
  200. // obj.funName = "role";
  201. obj.funName = "contentrole";
  202. obj.lang = $rootScope.selLanguage;
  203. obj.type = "dse"
  204. AppData.sendData($scope.commonurl, obj, function (res) {
  205. if (res.cont) {
  206. if (res.item != undefined) {
  207. $scope.role = res.item;
  208. }
  209. }
  210. })
  211. }
  212. $scope.getZone = function () {
  213. var zobj = {};
  214. zobj.funName = "zone";
  215. zobj.lang = $rootScope.selLanguage;
  216. AppData.sendData($scope.commonurl, zobj, function (res) {
  217. if (res.cont) {
  218. if (res.item != undefined) {
  219. $scope.zoneList = res.item;
  220. }
  221. }
  222. })
  223. }
  224. $scope.zoneChanged = function (item, i) {
  225. console.log(item)
  226. var obj = {};
  227. obj.cont = true;
  228. angular.forEach($scope.regionList, function (cityname, index) {
  229. if (item.zone == cityname.title) {
  230. angular.forEach(cityname.child, function (city, ind) {
  231. for (var k in $scope.formData.regionList) {
  232. if (city == k) {
  233. $scope.formData.regionList[k] = false;
  234. }
  235. }
  236. })
  237. console.log("helloooo", $scope.regionList)
  238. $scope.regionList.splice(index, 1);
  239. obj.cont = false;
  240. }
  241. })
  242. var fobj = {};
  243. fobj.lang = $rootScope.selLanguage;
  244. fobj.funName = "city";
  245. var zonename = item.zone;
  246. fobj.zone = (zonename == undefined) ? "" : zonename;
  247. if (obj.cont) {
  248. AppData.sendData($scope.commonurl, fobj, function (res) {
  249. $rootScope.pageLoadComp = true;
  250. if (res.cont) {
  251. if (res.item != undefined) {
  252. $scope.stateVisible = true;
  253. var arr = [];
  254. for (var id = 0; id < res.item.length; id++) {
  255. arr.push(res.item[id].city);
  256. }
  257. console.log(res.item, arr, "helloooo", $scope.regionList)
  258. $scope.regionList.push({ "title": zonename, "child": arr });
  259. console.log($scope.regionList)
  260. } else {
  261. $scope.regionList = [];
  262. $scope.dealerList = [];
  263. $scope.stateVisible = false;
  264. $scope.dealerVisible = false;
  265. }
  266. }
  267. });
  268. } else {
  269. //angular.forEach($scope.dealerList,function(item,index){
  270. if ($scope.dealerList.length != undefined) {
  271. for (i = 0; i < $scope.dealerList.length; i++) {
  272. for (var k in $scope.formData.regionList) {
  273. if ($scope.dealerList.length != undefined && $scope.dealerList.length > 0) {
  274. if (k == $scope.dealerList[i].title) {
  275. if ($scope.formData.regionList[k] == false) {
  276. angular.forEach($scope.dealerList[i].child, function (dealer, ind) {
  277. for (var j in $scope.formData.dealerList) {
  278. if (j == dealer.dealer_code) {
  279. $scope.formData.dealerList[j] = false;
  280. }
  281. }
  282. $scope.dealerList.splice(i, 1);
  283. })
  284. }
  285. }
  286. }
  287. }
  288. }
  289. }
  290. }
  291. }
  292. $scope.regionChanged = function (item, i) {
  293. console.log(item)
  294. var dobj = {};
  295. dobj.cont = true;
  296. if ($scope.dealerList != undefined) {
  297. angular.forEach($scope.dealerList, function (dealername, index) {
  298. if (item == dealername.title) {
  299. angular.forEach(dealername.child, function (dealer, ind) {
  300. for (var k in $scope.formData.dealerList) {
  301. if (dealer.dealer_code == k) {
  302. $scope.formData.dealerList[k] = false;
  303. }
  304. }
  305. })
  306. console.log("helloooo", $scope.dealerList)
  307. $scope.dealerList.splice(index, 1);
  308. dobj.cont = false;
  309. }
  310. })
  311. }
  312. var fobj = {};
  313. fobj.lang = $rootScope.selLanguage;
  314. fobj.funName = "dealer";
  315. var dealer_name = item;
  316. // if($scope.is_edit_dealer==false){
  317. // }else{
  318. // var dealer_name = item.toString();
  319. // $scope.is_edit_dealer= false;
  320. // }
  321. fobj.city = (dealer_name == undefined) ? "" : dealer_name;
  322. if (dobj.cont) {
  323. AppData.sendData($scope.commonurl, fobj, function (res) {
  324. $rootScope.pageLoadComp = true;
  325. if (res.cont) {
  326. if (res.item != undefined) {
  327. $scope.dealerVisible = true;
  328. var arr = [];
  329. for (var id = 0; id < res.item.length; id++) {
  330. var obj = {};
  331. obj.dealer_name = res.item[id].dealer_name;
  332. obj.dealer_code = res.item[id].dealer_code;
  333. arr.push(obj);
  334. }
  335. $scope.dealerList.push({ "title": dealer_name, "child": arr });
  336. console.log($scope.dealerList)
  337. } else {
  338. $scope.dealerVisible = false;
  339. $scope.dealerList = [];
  340. }
  341. }
  342. });
  343. } else {
  344. }
  345. }
  346. $scope.addFun = function () {
  347. $scope.formLoad = true;
  348. $scope.listFound = false;
  349. $scope.formAction = "Add";
  350. $scope.is_edit_region = false;
  351. $scope.is_edit_dealer = false;
  352. //$scope.title = $rootScope.sideselect.title[0];
  353. $scope.formData = {};
  354. $scope.zoneList = [];
  355. $scope.regionList = [];
  356. $scope.dealerList = [];
  357. $scope.formData.regionList = {};
  358. $scope.formData.dealerList = {};
  359. $rootScope.uploadfile = ""
  360. $scope.formData.roleList = [];
  361. $rootScope.formData.roleList = [];
  362. $scope.formLoad = true;
  363. $scope.formData.funName = "addbulletin";
  364. $scope.formTitle = "ADD BULLET-IN";
  365. angular.element("input[type='file']").val(null);
  366. $scope.getRole();
  367. $scope.getZone();
  368. }
  369. $rootScope.notifyChange = function () {
  370. if ($rootScope.formData.notification) {
  371. $rootScope.roleVisible = true;
  372. $rootScope.roleGroup = $scope.formData.roleList;
  373. if ($rootScope.roleGroup.length > 0) {
  374. angular.forEach($rootScope.roleGroup, function (element) {
  375. $rootScope.formData.roleList[element.id] = true;
  376. });
  377. }
  378. } else {
  379. $rootScope.roleVisible = false;
  380. }
  381. }
  382. $scope.deleterow = function (obj, i) {
  383. $scope.formData = obj;
  384. $scope.selectedIndex = i;
  385. $scope.deleteFun();
  386. }
  387. $scope.viewDetails = function () {
  388. console.log("here")
  389. var obj = {};
  390. obj.funName = "bulletindetails";
  391. obj.lang = $rootScope.selLanguage;
  392. obj.bulletin_id = $scope.formData.bulletin_id;
  393. AppData.sendData($scope.pageurl, obj, function (res) {
  394. $rootScope.pageLoadComp = true;
  395. if (res.cont) {
  396. $scope.formData = res.item;
  397. $scope.image_url = $scope.formData.image_url;
  398. $scope.formData.zoneList = {};
  399. $scope.formData.regionList = {};
  400. $scope.formData.dealerList = {};
  401. if ($scope.formData.filter_zone.length > 0) {
  402. angular.forEach($scope.formData.filter_zone, function (element, index) {
  403. console.log(element, "zoneee")
  404. $scope.formData.zoneList[element.zone] = true;
  405. if (element != '') {
  406. $scope.zoneChanged(element, index);
  407. }
  408. });
  409. } else {
  410. $scope.stateVisible = false;
  411. $scope.dealerVisible = false;
  412. }
  413. if ($scope.formData.filter_region.length > 0) {
  414. angular.forEach($scope.formData.filter_region, function (element, index) {
  415. $scope.formData.regionList[element.city] = true;
  416. if (element != '') {
  417. $scope.regionChanged(element['city'], index);
  418. }
  419. });
  420. } else {
  421. $scope.dealerVisible = false;
  422. }
  423. if ($scope.formData.filter_dealer.length > 0) {
  424. angular.forEach($scope.formData.filter_dealer, function (element) {
  425. console.log(element)
  426. $scope.formData.dealerList[element.dealer_code] = true;
  427. });
  428. $scope.dealerVisible = true;
  429. }
  430. $scope.formData.roleList = $scope.formData.filter_role_name;
  431. console.log($scope.formData.roleList, "$scope.formData.roleList ", $scope.formData.filter_role_name)
  432. }
  433. })
  434. }
  435. $scope.editFun = function () {
  436. $scope.filerequired = false;
  437. $scope.thmbrequired = false;
  438. $scope.formAction = "Edit";
  439. $scope.is_edit_region = true;
  440. $scope.is_edit_dealer = true;
  441. $(".clsbuttoncont .clsbutton").addClass("disable_btn");
  442. $scope.formLoad = true;
  443. $scope.listFound = false;
  444. angular.element("input[type='file']").val(null);
  445. if ($scope.selectedIndex != null) {
  446. $scope.formTitle = "EDIT BULLET-IN";
  447. $scope.getRole();
  448. $scope.getZone();
  449. $scope.viewDetails();
  450. } else {
  451. $rootScope.modalShown = true;
  452. $rootScope.message = $scope.pageData.errorMsg[0];
  453. }
  454. }
  455. $scope.editrow = function (obj, i) {
  456. $scope.formData = obj;
  457. $scope.formData.catename = obj.catename;
  458. $scope.selectedIndex = i;
  459. $scope.search_box = false;
  460. $scope.listFound = false;
  461. $scope.formLoad = true;
  462. $scope.formAction = "Edit";
  463. angular.element("input[type='file']").val(null);
  464. $rootScope.prodimage = '';
  465. $scope.editFun();
  466. }
  467. $scope.deleteFun = function () {
  468. if ($scope.selectedIndex != null) {
  469. $rootScope.cofirmWindow = true;
  470. $rootScope.modalShown = true;
  471. $rootScope.message = $scope.pageData.errorMsg[1];
  472. } else {
  473. $rootScope.modalShown = true;
  474. $rootScope.message = $scope.pageData.errorMsg[0];
  475. }
  476. }
  477. $scope.$on("confirmDelete", function () {
  478. $scope.formData.funName = "deletebulletin";
  479. $scope.url = $scope.pageurl
  480. $scope.formData.lang = $rootScope.selLanguage;
  481. AppData.sendData($scope.url, $scope.formData, function (res) {
  482. if (res.cont) {
  483. var index = $scope.bulletList.indexOf($scope.formData);
  484. if (index != -1) {
  485. $scope.bulletList.splice(index, 1);
  486. }
  487. $rootScope.modalShown = true;
  488. $rootScope.cofirmWindow = false;
  489. $rootScope.message = (res.mess);
  490. } else {
  491. $rootScope.modalShown = true;
  492. $rootScope.message = (res.mess);
  493. }
  494. })
  495. })
  496. $scope.onSearchChange = function () {
  497. $scope.bulletinList();
  498. }
  499. $scope.listClick = function (obj) {
  500. $scope.searchtext = '';
  501. $scope.formData = {}
  502. $scope.currentPage = 1;
  503. $(".clsbuttoncont .clsbutton").removeClass("disable_btn");
  504. $scope.formLoad = false;
  505. $rootScope.sideselect = obj;
  506. $scope.selectedIndex = null;
  507. $rootScope.sideselect.name = obj.name;
  508. $scope.tblheading = obj.headingText;
  509. $scope.bulletinList();
  510. }
  511. $scope.fieldValidation = function () {
  512. $scope.clearErrorMsg()
  513. $scope.role_error = ($scope.formData.roleList == undefined || $scope.formData.roleList == '') ? 'Please choose role' : '';
  514. // $scope.zone_error = ($scope.formData.zoneList == undefined || $scope.formData.zoneList == '') ? 'Please choose zone' : '';
  515. $scope.image_error = ($rootScope.uploadfile == undefined || $rootScope.uploadfile == '') ? 'Please upload the image' : '';
  516. $scope.segment_error = ($scope.formData.segment == undefined || $scope.formData.segment == '') ? 'Please any one' : '';
  517. //console.log($rootScope.uploadfile)
  518. return ($scope.role_error == '' && $scope.image_error=='' && $scope.segment_error=='') ? true : false;
  519. }
  520. $scope.clearErrorMsg = function () {
  521. $scope.role_error = '';
  522. $scope.zone_error = '';
  523. $scope.image_error = '';
  524. $scope.segment_error='';
  525. // $scope.topic_error = '';
  526. }
  527. $scope.formSubmit = function () {
  528. console.log($scope.fieldValidation())
  529. if ($scope.fieldValidation()) {
  530. var formData = new FormData();
  531. if ($scope.formAction == "Add") {
  532. formData.append("funName", "addbulletin");
  533. } else if ($scope.formAction == "Edit") {
  534. formData.append("bulletin_id", $scope.formData.bulletin_id);
  535. formData.append("funName", "updatebulletin");
  536. }
  537. formData.append("lang", $rootScope.selLanguage);
  538. formData.append("bulletin_title", $scope.formData.bulletin_title);
  539. formData.append("bulletin_sdesc", $scope.formData.bulletin_sdesc);
  540. formData.append("bulletin_desc", $scope.formData.bulletin_desc);
  541. formData.append("segment", $scope.formData.segment);
  542. formData.append("file", $rootScope.uploadfile);
  543. if ($scope.formData.cityList != undefined) {
  544. var cityarr = [];
  545. for (k in $scope.formData.cityList) {
  546. if ($scope.formData.cityList[k] == true) {
  547. cityarr.push(k)
  548. }
  549. }
  550. if (cityarr.length != 0) {
  551. formData.append("filter_city", cityarr.toString());
  552. }
  553. }
  554. if ($scope.formData.regionList != undefined) {
  555. var statearr = [];
  556. for (k in $scope.formData.regionList) {
  557. if ($scope.formData.regionList[k] == true) {
  558. statearr.push(k)
  559. }
  560. }
  561. if (statearr.length != 0) {
  562. formData.append("filter_region", statearr.toString());
  563. }
  564. }
  565. if ($scope.formData.dealerList != undefined) {
  566. var dealerarr = [];
  567. for (k in $scope.formData.dealerList) {
  568. if ($scope.formData.dealerList[k] == true) {
  569. dealerarr.push(k)
  570. }
  571. }
  572. if (dealerarr.length != 0) {
  573. formData.append("filter_dealer", dealerarr.toString());
  574. }
  575. }
  576. if ($scope.formData.zoneList != undefined) {
  577. var zonearr = [];
  578. for (k in $scope.formData.zoneList) {
  579. if ($scope.formData.zoneList[k] == true) {
  580. zonearr.push(k)
  581. }
  582. }
  583. if (zonearr.length != 0) {
  584. formData.append("filter_zone", zonearr.toString());
  585. }
  586. }
  587. if ($scope.formData.roleList.length != 0) {
  588. var rolearr = [];
  589. for (var id = 0; id < $scope.formData.roleList.length; id++) {
  590. rolearr.push($scope.formData.roleList[id].id)
  591. }
  592. formData.append("filter_role", rolearr.toString());
  593. }
  594. UploadFileService.upload(formData, function (data) {
  595. var response = JSON.parse(data)
  596. console.log(response, 'response')
  597. if (response.cont) {
  598. var obj = response.item;
  599. $scope.$apply(function () {
  600. $scope.formLoad = false;
  601. $scope.listFound = true;
  602. $scope.formData = {}
  603. $scope.bulletinList();
  604. $scope.selectedIndex = null;
  605. $rootScope.loadingCont = false;
  606. $rootScope.pageLoadComp = true;
  607. $rootScope.modalShown = true;
  608. $rootScope.message = response.mess;
  609. })
  610. } else {
  611. alert("alert")
  612. $rootScope.loadingCont = false;
  613. $rootScope.pageLoadComp = false;
  614. }
  615. });
  616. }
  617. }
  618. $scope.closeForm = function () {
  619. $scope.formLoad = false;
  620. $scope.listFound = true;
  621. $scope.formData = {};
  622. $scope.selectedIndex = null;
  623. $scope.search_box = true;
  624. $scope.zoneList = [];
  625. $scope.regionList = [];
  626. $scope.dealerList = [];
  627. $scope.clearErrorMsg();
  628. }
  629. });
  630. });